Hi all!
I have a simple java search client with which I am querying the index
created by solr. Most of the time, I am seeing consistent results - in
other words, when my query is 'title:dog' with my client, I get 46 matching
documents, and when I have a 'q=title:dog' in the solr url, I also get 46
matching documents as I would expect.
However, when I search with 'q=ethics' in solr, I get almost 10,000 matches.
With my client, I get 0. What is going on here? Is the clue here that the
word 'ethics' appears with relatively high frequency?
The simple client I refer to looks like so:
public class SolrSearch {
private static String indexDir =
"/usr/local/apache-tomcat-5.5.20/conf/solr/data/index";
// ================================================================
public static void main( String[] args ) throws IOException {
IndexSearcher searcher = new IndexSearcher( indexDir );
Query query = new TermQuery( new Term( args[0], args[1] ) );
System.out.println ( "query: " + query.toString() );
Hits hits = searcher.search( query );
System.out.println( "search for " + args[1] + " within " + args[0]
);
System.out.println( hits.length() + " matching entries" );
}
If anyone can help me see the error of my ways, I will appreciate it!
Cheers,
Bill