Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boolean NOT in solr query

Tags:

solr

How do I pick/ delete all the documents from Solr using the boolean NOT notion?

i.e. How do I delete all the documents from Solr who's id does NOT start with A59?

like image 799
Mohit Ranka Avatar asked Nov 07 '08 05:11

Mohit Ranka


People also ask

How use contains in solr query?

1)How to search solr for contains You can store data into string type of field or text type of field. In string field by wild card searching you can achieve the result (E.g field1:"John*"). Also you should look into different types of analyzers.

What is the difference between Q and FQ in solr?

Standard solr queries use the "q" parameter in a request. Filter queries use the "fq" parameter. The primary difference is that filtered queries do not affect relevance scores; the query functions purely as a filter (docset intersection, essentially).

How do I query in solr collection?

You can search for "solr" by loading the Admin UI Query tab, enter "solr" in the q param (replacing *:* , which matches all documents), and "Execute Query". See the Searching section below for more information. To index your own data, re-run the directory indexing command pointed to your own directory of documents.

What is fuzzy search in solr?

Solr's standard query parser supports fuzzy searches based on the Damerau-Levenshtein Distance or Edit Distance algorithm. Fuzzy searches discover terms that are similar to a specified term without necessarily being an exact match. To perform a fuzzy search, use the tilde ~ symbol at the end of a single-word term.


1 Answers

Use - to indicate NOT.

For example, to query documents with id not starting with A59, the query would be: -id:A59*, that is: /solr/select/?q=-id:A59*

To delete by query, post the query in a delete message to the update handler, as specified here.

EDIT: NOT (all uppercase) can also be used as boolean operator

like image 72
Mauricio Scheffer Avatar answered Sep 23 '22 03:09

Mauricio Scheffer