solr search for documents where a field doesn’t exist
-field:[* TO *] In SolrNet, use a negated SolrHasValueQuery
-field:[* TO *] In SolrNet, use a negated SolrHasValueQuery
Use field:(value1 value2 value3) or if your default operator is AND then use field:(value1 OR value2 OR value3)
Here’s what I’m using. Is this canonical? Is there a better way? SolrQuery q = new SolrQuery(“*:*”); q.setRows(0); // don’t actually request any data return server.query(q).getResults().getNumFound();
Store.Yes Means that the value of the field will be stored in the index Store.No Means that the value of the field will NOT be stored in the index Store.Yes/No does not affect the indexing or searching with lucene. It just tells lucene if you want it to act as a datastore for the values … Read more
The Lucene index is split into smaller chunks called segments. Each segment is its own index. Lucene searches all of them in sequence. A new segment is created when a new writer is opened and when a writer commits or is closed. The advantages of using this system are that you never have to modify … Read more
Turns out this is happening because the mapping needs to be applied to the type: I tried applying it to the wrong thing: curl -XPUT 10.160.86.134:9200/products/_mapping -d ‘{ It needs to be applied to the type like so: curl -XPUT 10.160.86.134:9200/products/product/_mapping -d ‘{ It’s sad that a simple google search couldn’t answer this. Also the … Read more
/?q=query&fl=field1,field2,field3
I once listened to an interview with author Ursula K. LeGuin about fiction writing. The interviewer asked her about authors who work in different genre of writing. What makes one author a romance writer, and another a mystery writer, and another a science fiction writer? LeGuin responded by explaining: Genre is about marketing, not about … Read more
Lucene is an inverted full-text index. This means that it takes all the documents, splits them into words, and then builds an index for each word. Since the index is an exact string-match, unordered, it can be extremely fast. Hypothetically, an SQL unordered index on a varchar field could be just as fast, and in … Read more