lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy" <>
Subject RE: [jira] Commented: (LUCENENET-41) querystring is case-sensitive?
Date Mon, 18 Jun 2007 18:01:37 GMT
Shenqihua & Shen,

If you use "TermQuery" than you should give the search string as it is stored in the index(mostly
But with  "QueryParser", you can get the expected results.

I run that sample code and got the following results(see the use of Analyzers).

            IndexWriter wr = new IndexWriter("IndexAAA", new Lucene.Net.Analysis.Standard.StandardAnalyzer(),
true); //<--
            Document doc = new Document();
            Field f = new Field("Field1", "Mobile", Field.Store.YES, Field.Index.TOKENIZED);

            string[] queries = new string[] { "Mobile", "mobile", "MoBIle" };
            for (int i = 0; i < queries.Length; i++)
                IndexSearcher s = new IndexSearcher("IndexAAA");
                QueryParser parser = new QueryParser("Field1", new Lucene.Net.Analysis.Standard.StandardAnalyzer());
                Query q = parser.Parse(queries[i]);
                Hits hits = s.Search(q);
                richTextBox1.AppendText(hits.Length().ToString() + " hits found\n");

1 hits found
1 hits found
1 hits found


-----Original Message-----
From: Shen Koffer (JIRA) [] 
Sent: Monday, June 18, 2007 12:19 PM
Subject: [jira] Commented: (LUCENENET-41) querystring is case-sensitive?


Shen Koffer commented on LUCENENET-41:

Thanks for your informaiton. I tested the following analyzer:

1. StandardAnalyzer/ SimpleAnalyzer/ StopAnalyzer
Re: QueryString should be in lower case

2. WhitespaceAnalyzer
Re: QueryString As is

3. KeywordAnalyzer
Re: Neither works

Is there any analyzer, which can handle "Mobile", "mobile", "MoBIle", etc?

> querystring is case-sensitive?
> ------------------------------
>                 Key: LUCENENET-41
>                 URL:
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: OS: windows XP SP2; .Net 2005; 2.0; IBM laptop T42
>            Reporter: Shen Koffer
>            Priority: Minor
> I have one text file: one.txt. In this file, I put only one line of data: Mobile.
> The indexing process completes without any error.
> In the search code, I created a new query like this,
>  Query query = new TermQuery(new Term("Content", queryString));
> The queryString passed in is "Mobile". 
> With this, I can NOT search out any result.
> But if I change the queryString to "mobile" ( Notice: all in lower case).
> I can get the expected result.
> The defect is when the user try to search some word, he should input the word in lower
case, rather than as-is.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message