I have a need to search an index for documents that were taken ffrom particulars files in the filesystem.

Each document in the index has a field named "url" that is created using:

        doc.add(Field.Text("url", urlStr));

I understand this is both stored and indexed.

My search works if I do something like:

String queryStr = "\"file:///someDir/someOtherDir/File.txt\""
query = MultiFieldQueryParser.parse("url:" + queryString, searchedFields, new StandardAnalyzer());
hits = searcher.search(query);


It is important for me to quote the path for the search to succeed

I was hoping to speed the search up a bit by bypassing the QueryParser. However, if I do something like

        String queryStr = "\"file:///someDir/someOtherDir/File.txt\""
        Query query = new TermQuery(new Term("url", queryStr));
        hits = searcher.search(query);

I get zero hits. Why are these not equivalent? I think it has something to do with the fact that the url needs to be quoted so I search for an exact match. It does work if I have stored the url as a "Field.Keyword" rather than as "Field.Text" and then don't need to quote the string. However I would prefer not to have to change the format of the index.

Thanks for any help.

--
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to