Re: how to do exact serch with solrj
No, not text, but with that tokenizer + token filter I mentioned below. Anchors should not be needed if string is used, but the o.p. didn't want string, because he wanted lowercasing (or does string lowercase?) Of course, one could lowercase before indexing and use string type. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Avlesh Singh avl...@gmail.com To: solr-user@lucene.apache.org Sent: Friday, June 5, 2009 12:37:20 AM Subject: Re: how to do exact serch with solrj And the field should be of type, text, right Otis? Does one still need those anchors if the type is string with the filters you suggested? Cheers Avlesh On Fri, Jun 5, 2009 at 6:35 AM, Otis Gospodnetic wrote: I re-read your original request. Here is the recipe that should work: * Define new field type that: Uses KeywordTokenizer Uses LowerCaseFilter * Make your field be of the above type. * Use those begin/end anchor characters at index and search time. I believe that should work. Please try it and let us know. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Otis Gospodnetic To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 8:47:50 PM Subject: Re: how to do exact serch with solrj I don't think there is anything ready to be used in Solr (but would be easy to add), but if you indexed your with a custom beginning of string and end of string anchors, you'll be able to get your exact matching working. For example, convert hello the world to $hello the world$ before indexing (and make sure you use string type or KeywordTokenizer -- things that won't remove any characters. Then search for $hello the world$. This will not match $hello the world, Jack$. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Jianbin Dai To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 6:42:39 PM Subject: Re: how to do exact serch with solrj I still have a problem with exact matching. query.setQuery(title:\hello the world\); This will return all docs with title containing hello the world, i.e., hello the world, Jack will also be matched. What I want is exactly hello the world. Setting this field to string instead of text doesn't work well either, because I want something like Hello, The World to be matched as well. Any idea? Thanks. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
I still have a problem with exact matching. query.setQuery(title:\hello the world\); This will return all docs with title containing hello the world, i.e., hello the world, Jack will also be matched. What I want is exactly hello the world. Setting this field to string instead of text doesn't work well either, because I want something like Hello, The World to be matched as well. Any idea? Thanks. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai djian...@yahoo.com wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai djian...@yahoo.com wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
I don't think there is anything ready to be used in Solr (but would be easy to add), but if you indexed your with a custom beginning of string and end of string anchors, you'll be able to get your exact matching working. For example, convert hello the world to $hello the world$ before indexing (and make sure you use string type or KeywordTokenizer -- things that won't remove any characters. Then search for $hello the world$. This will not match $hello the world, Jack$. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Jianbin Dai djian...@yahoo.com To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 6:42:39 PM Subject: Re: how to do exact serch with solrj I still have a problem with exact matching. query.setQuery(title:\hello the world\); This will return all docs with title containing hello the world, i.e., hello the world, Jack will also be matched. What I want is exactly hello the world. Setting this field to string instead of text doesn't work well either, because I want something like Hello, The World to be matched as well. Any idea? Thanks. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
I re-read your original request. Here is the recipe that should work: * Define new field type that: Uses KeywordTokenizer Uses LowerCaseFilter * Make your field be of the above type. * Use those begin/end anchor characters at index and search time. I believe that should work. Please try it and let us know. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Otis Gospodnetic otis_gospodne...@yahoo.com To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 8:47:50 PM Subject: Re: how to do exact serch with solrj I don't think there is anything ready to be used in Solr (but would be easy to add), but if you indexed your with a custom beginning of string and end of string anchors, you'll be able to get your exact matching working. For example, convert hello the world to $hello the world$ before indexing (and make sure you use string type or KeywordTokenizer -- things that won't remove any characters. Then search for $hello the world$. This will not match $hello the world, Jack$. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Jianbin Dai To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 6:42:39 PM Subject: Re: how to do exact serch with solrj I still have a problem with exact matching. query.setQuery(title:\hello the world\); This will return all docs with title containing hello the world, i.e., hello the world, Jack will also be matched. What I want is exactly hello the world. Setting this field to string instead of text doesn't work well either, because I want something like Hello, The World to be matched as well. Any idea? Thanks. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
And the field should be of type, text, right Otis? Does one still need those anchors if the type is string with the filters you suggested? Cheers Avlesh On Fri, Jun 5, 2009 at 6:35 AM, Otis Gospodnetic otis_gospodne...@yahoo.com wrote: I re-read your original request. Here is the recipe that should work: * Define new field type that: Uses KeywordTokenizer Uses LowerCaseFilter * Make your field be of the above type. * Use those begin/end anchor characters at index and search time. I believe that should work. Please try it and let us know. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Otis Gospodnetic otis_gospodne...@yahoo.com To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 8:47:50 PM Subject: Re: how to do exact serch with solrj I don't think there is anything ready to be used in Solr (but would be easy to add), but if you indexed your with a custom beginning of string and end of string anchors, you'll be able to get your exact matching working. For example, convert hello the world to $hello the world$ before indexing (and make sure you use string type or KeywordTokenizer -- things that won't remove any characters. Then search for $hello the world$. This will not match $hello the world, Jack$. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message From: Jianbin Dai To: solr-user@lucene.apache.org Sent: Thursday, June 4, 2009 6:42:39 PM Subject: Re: how to do exact serch with solrj I still have a problem with exact matching. query.setQuery(title:\hello the world\); This will return all docs with title containing hello the world, i.e., hello the world, Jack will also be matched. What I want is exactly hello the world. Setting this field to string instead of text doesn't work well either, because I want something like Hello, The World to be matched as well. Any idea? Thanks. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh wrote: From: Avlesh Singh Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai djian...@yahoo.com wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai djian...@yahoo.com wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai djian...@yahoo.com wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
That's correct! Thanks Avlesh. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 11:45 PM You need exact match for all the three tokens? If yes, try query.setQuery(title:\hello the world\); Cheers Avlesh On Sun, May 31, 2009 at 12:12 PM, Jianbin Dai djian...@yahoo.com wrote: I tried, but seems it's not working right. --- On Sat, 5/30/09, Avlesh Singh avl...@gmail.com wrote: From: Avlesh Singh avl...@gmail.com Subject: Re: how to do exact serch with solrj To: solr-user@lucene.apache.org Date: Saturday, May 30, 2009, 10:56 PM query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai djian...@yahoo.com wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB
Re: how to do exact serch with solrj
query.setQuery(title:hello the world) is what you need. Cheers Avlesh On Sun, May 31, 2009 at 6:23 AM, Jianbin Dai djian...@yahoo.com wrote: Hi, I want to search hello the world in the title field using solrj. I set the query filter query.addFilterQuery(title); query.setQuery(hello the world); but it returns not exact match results as well. I know one way to do it is to set title field to string instead of text. But is there any way i can do it? If I do the search through web interface Solr Admin by title:hello the world, it returns exact matches. Thanks. JB