lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From digy digy <digyd...@gmail.com>
Subject Re: [Lucene.Net] Lucene .Net search with Standard Analyzer does not work properly with keywords containing - (hyphen)
Date Thu, 12 May 2011 07:28:32 GMT
On Thu, May 12, 2011 at 7:53 AM, Vasudeva Bhandarkar <Vasudeva_B@infosys.com
> wrote:

> Hi,
>
> I am using the Lucene.Net.dll version 2.0.0.4 with Standard Analyzer mode.
> We are using the Lucene.Net to perform a search on the Index files.
>
>
 I strongly recommend to upgrade to 2.9.2


> I found that the Lucene search does not work properly when I search for
> some data like abc-bcd. Though there are sufficient number of records with
> abc-bcd, it does not return any results.
>
> But when I search for something like 2,4-D fetches me all the matching
> records.
>
> Could you please help me in finding out what is the issue and why this
> search abc-bcd does not fetch result?
>
> I have also tried escape character \ in the search query like:
>
> abc\-bcd
>
> I found some information on this in the web link given below, but I could
> not resolve the issue.
>
> http://lucene.apache.org/java/2_4_0/queryparsersyntax.html
>
> Could  you please let me know if I am missing something here.
>

Here is a sample code. Compare with your code to see what is going wrong.

            *RAMDirectory dir = new RAMDirectory();*
*
*
*            //Add one doc*
*            IndexWriter wr = new IndexWriter(dir, new StandardAnalyzer(),
true);*
*            Document doc = new Document();*
*            doc.Add(new Field("field", "abc-def", Field.Store.YES,
Field.Index.TOKENIZED));*
*            wr.AddDocument(doc);*
*            wr.Close();*
*
*
*            //Search*
*            IndexReader rdr = Lucene.Net.Index.IndexReader.Open(dir);*
*            IndexSearcher src = new IndexSearcher(rdr);*
*            Query query = new QueryParser("field", new
StandardAnalyzer()).Parse("abc-def");*
*            TopDocs topdocs = src.Search(query, 1);*
*            MessageBox.Show(topdocs.ScoreDocs.Length.ToString());*



>
> Also if you could provide me the details of any support group that can help
> me with Lucene .Net related issues, that will be really helpful.
>

This is the correct list, but you should subscribe to post messages.


> Thank you.
>
> Best Regards,
> Vas
>
>
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended
> solely
> for the use of the addressee(s). If you are not the intended recipient,
> please
> notify the sender by e-mail and delete the original message. Further, you
> are not
> to copy, disclose, or distribute this e-mail or its contents to any other
> person and
> any such actions are unlawful. This e-mail may contain viruses. Infosys has
> taken
> every reasonable precaution to minimize this risk, but is not liable for
> any damage
> you may sustain as a result of any virus in this e-mail. You should carry
> out your
> own virus checks before opening the e-mail or attachment. Infosys reserves
> the
> right to monitor and review the content of all messages sent to or from
> this e-mail
> address. Messages sent to or from this e-mail address may be stored on the
> Infosys e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>



DIGY

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message