Re: Search data who does not have x field
Sorry, I didnt explain my self good, I mean , you have to create an additional field 'hasCategory' in your schema, and then, before indexing, set the field 'hasCategory' in the indexed document as true, if your document has categories, or set it to false, if it has any. With this you will save computation time, since the query for a boolean field is much easier for Solr than checking for an empty string field. The query should be = q=*:*fq=hasCategory:true anurag.jain wrote another solution would be to add a boolean field, hasCategory, and use it for filtering q= your query here fq=hasCategory:true I am not getting result. i am trying localhost:8983/search?q=*:*fq=category:true it is giving zero result. by the way first technique is working fine. -- View this message in context: http://lucene.472066.n3.nabble.com/Search-data-who-does-not-have-x-field-tp4046959p4054763.html Sent from the Solr - User mailing list archive at Nabble.com.
New-Question On Search data who does not have x field
My prev question was I have updated 250 data to solr. and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:30 }, { id:3, name:john } now i want to search that docs who does not have that field. what query should like. I got an answer. i can use http://localhost:8983/search?q=*:*fq=-category:[* TO *] but now i am facing a problem. that i want to search all docs .. who does not have category field or category field value = 20 I wrote following query. http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; OR -category:[* TO *] but it is giving me zero output. http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; - output = 2689 http://localhost:8983/search?q=*:*wt=jsonstart=0fq=-category:[* TO *] - output = 2644684 what is problem ... am i doing some mistakes ?? -- View this message in context: http://lucene.472066.n3.nabble.com/New-Question-On-Search-data-who-does-not-have-x-field-tp4047270.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: New-Question On Search data who does not have x field
Writing OR - is simply the same as -, so the query would match documents containing category 20 and then remove all documents that had any category (including 20) specified, giving you nothing. Try: http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; OR (*:* -category:[* TO *]) Technically, the following should work, but there have been bugs with pure negative queries and sub-queries, so it may or may not work: http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; OR (-category:[* TO *]) -- Jack Krupansky -Original Message- From: anurag.jain Sent: Thursday, March 14, 2013 3:48 AM To: solr-user@lucene.apache.org Subject: New-Question On Search data who does not have x field My prev question was I have updated 250 data to solr. and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:30 }, { id:3, name:john } now i want to search that docs who does not have that field. what query should like. I got an answer. i can use http://localhost:8983/search?q=*:*fq=-category:[* TO *] but now i am facing a problem. that i want to search all docs .. who does not have category field or category field value = 20 I wrote following query. http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; OR -category:[* TO *] but it is giving me zero output. http://localhost:8983/search?q=*:*wt=jsonstart=0fq=category:20; - output = 2689 http://localhost:8983/search?q=*:*wt=jsonstart=0fq=-category:[* TO *] - output = 2644684 what is problem ... am i doing some mistakes ?? -- View this message in context: http://lucene.472066.n3.nabble.com/New-Question-On-Search-data-who-does-not-have-x-field-tp4047270.html Sent from the Solr - User mailing list archive at Nabble.com.
Search data who does not have x field
Hi all, I am facing a problem. Problem is: I have updated 250 data to solr. and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:x }, { id:3, name:john } now i want to search that data who does not have that field. what query should like. please reply It is very urgent - i have to complete this task by today itself thanks in advance. -- View this message in context: http://lucene.472066.n3.nabble.com/Search-data-who-does-not-have-x-field-tp4046959.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search data who does not have x field
Hello! You can for example add a filter, that will remove the documents that doesn't have a value in a field, like: fq=!category:[*+TO+*] -- Regards, Rafał Kuć Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch Hi all, I am facing a problem. Problem is: I have updated 250 data to solr. and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:x }, { id:3, name:john } now i want to search that data who does not have that field. what query should like. please reply It is very urgent - i have to complete this task by today itself thanks in advance. -- View this message in context: http://lucene.472066.n3.nabble.com/Search-data-who-does-not-have-x-field-tp4046959.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search data who does not have x field
add this to your query, or filter query: q=your query herefq=-category:[* TO *] another solution would be to add a boolean field, hasCategory, and use it for filtering q=your query herefq=hasCategory:true Victor anurag.jain wrote Hi all, I am facing a problem. Problem is: I have updated 250 data to solr. and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:x }, { id:3, name:john } now i want to search that data who does not have that field. what query should like. please reply It is very urgent - i have to complete this task by today itself thanks in advance. -- View this message in context: http://lucene.472066.n3.nabble.com/Search-data-who-does-not-have-x-field-tp4046959p4046961.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Search data who does not have x field
On 13 March 2013 17:57, anurag.jain anurag.k...@gmail.com wrote: Hi all, I am facing a problem. [...] and some of data have category field and some of don't have. for example. { id:321, name:anurag, category:x }, { id:3, name:john } now i want to search that data who does not have that field. what query should like. [...] Your subject line, and example are a bit confusing. I am guessing that you want all records where the (not required) category field does not exist. As http://wiki.apache.org/solr/SolrQuerySyntax notes, -category:[* TO *] should do that. Regards, Gora
Re: Search data who does not have x field
another solution would be to add a boolean field, hasCategory, and use it for filtering q=your query herefq=hasCategory:true I am not getting result. i am trying localhost:8983/search?q=*:*fq=category:true it is giving zero result. by the way first technique is working fine. -- View this message in context: http://lucene.472066.n3.nabble.com/Search-data-who-does-not-have-x-field-tp4046959p4046967.html Sent from the Solr - User mailing list archive at Nabble.com.