This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple Python script to send messages to a sever over Bluetooth using | |
Python sockets (with Python 3.3 or above). | |
""" | |
import socket | |
serverMACAddress = '00:1f:e1:dd:08:3d' | |
port = 3 | |
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SimpleSolrSearch { | |
private String solrUrl = "http://192.168.1.103:8983/solr/auctions"; | |
private SolrServer server; | |
public SimpleSolrSearch() { | |
server = new HttpSolrServer(solrUrl); | |
} | |
public Collection<Integer> search(String searchTerms, String category, BigDecimal maxBidAmount) throws SolrServerException { | |
SolrQuery query = new SolrQuery(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<requestHandler name="/broadQuery" class="solr.SearchHandler"> | |
<lst name="defaults"> | |
<str name="defType">edismax</str> <!-- The search parser to use. --> | |
<str name="wt">xml</str> <!-- Output type. --> | |
<str name="fl">auction_id title</str> <!-- The fields to list in the search response --> | |
<str name="qf">Title^2 Feature</str> <!-- The fields (and their weightings) to search in.--> | |
<str name="rows">100</str> <!-- The number of results to return. --> | |
<str name="pf">Title^4 Feature^2</str> <!-- Phrase field (and their weightings). Fields to search for closely located matches. --> | |
<str name="ps">0</str> <!-- Phrase slop. How many tokens apart must words be to be able to qualify as a phrase--> | |
<str name="echoParams">all</str> <!-- Print the search settings in the search results. Just a handy feature --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!-- the 2.0 version of xsl reqires a custom processor to be used. Saxon9he is used, and is | |
located in Jetty's ext/ folder. This library requires Jetty to be started like so: | |
java -Djavax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl -jar start.jar | |
--> | |
<xsl:stylesheet version="2.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:fn="http://www.w3.org/2005/xpath-functions" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- original XML format: --> | |
<auction> | |
<auction_id>54432834</auction_id> | |
<title>Dell M2012 24" IPS Monitor</title> | |
<category>monitors</category> | |
<current_bid>279.95</current_bid> | |
</auction> | |
<!-- The format Solr requires: --> | |
<doc> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- in solrconfig.xml --> | |
<requestHandler name="/update" class="solr.UpdateRequestHandler" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- What an auction might look like in its original XML form: --> | |
<auction> | |
<title>Desktop PC</title> | |
<feature> | |
<name>RAM</name> | |
<value>16 GB</value> | |
</feature> | |
<feature> | |
<name>CPU Frequency</name> | |
<value>4.5 GHz</value> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100"> | |
<analyzer type="index"> | |
<tokenizer class="solr.StandardTokenizerFactory"/> | |
<filter class="solr.StopFilterFactory" | |
ignoreCase="true" | |
words="lang/stopwords_en.txt" | |
enablePositionIncrements="true" | |
/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<filter class="solr.EnglishPossessiveFilterFactory"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<schema name="example" version="1.5"> | |
<fields> | |
<field name="title" type="text_en" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="category" type="string" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="feature" type="string" indexed="true" stored="true" required="false" multiValued="true" /> | |
<field name="allText" type="text_en" indexed="true" stored="false" required="true" multiValued="true" /> | |
</fields> | |
<copyField source="title" dest="allText" /> | |
<copyField source="category" dest="allText" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<schema name="example" version="1.5"> | |
<fields> | |
<field name="_version_" type="long" indexed="true" stored="true" required="true"/> | |
<field name="auction_id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="title" type="text_en" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="category" type="string" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="current_bid" type="currency" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="end_date" type="date" indexed="true" stored="true" required="true" multiValued="false" /> | |
<field name="feature" type="string" indexed="true" stored="true" required="false" multiValued="true" /> | |
</fields> |