I think "U/S" is tokenized to 'U' and 'S'. Sicne the query parser is using the same analyzer/tokenizer, the search for "U/S" is actually the same as the phrase query: "U S". Which explains why it is a hit but not in the index.
-John On Nov 17, 2007 4:58 AM, Grant Ingersoll <[EMAIL PROTECTED]> wrote: > http://wiki.apache.org/lucene-java/LuceneFAQ#head-3558e5121806fb4fce80fc022d889484a9248b71 > > Have a look at what the StandardTokenizer is doing (inside the > StandardAnalyzer). > > > > On Nov 17, 2007, at 7:46 AM, Shakti_Sareen wrote: > > > Hi > > > > > > > > I am facing problem in searching the word containing forward slash > > (/). > > > > My index file contains more then one documents. > > > > On searching for the word "U/S" in the claims field I am getting hits. > > > > But the word "U/S" is actually not there in the document. > > > > > > > > Below is the code I am using for searching. > > > > Analyzer analyzer = null; > > > > analyzer = new StandardAnalyzer(); > > > > IndexSearcher searcher = new > > IndexSearcher(fIndexFolder.getAbsolutePath()); > > > > QueryParser parser = new > > QueryParser("Claim",analyzer); > > > > Query query = parser.parse("U/S"); > > > > > > Hits hits = searcher.search(query); > > > > LOGGER.info("Hits of word U/S in claims > > :::::::: " + hits.length()); > > > > for (int i = 0; i < hits.length(); i++) > > { > > > > docum = hits.doc(i); > > > > LOGGER.info("file > > NUMBER > >>>>> " + docum.get("PatentNumber")); > > > > } > > > > > > > > Regards > > SHAKTI SAREEN > > > > > > DISCLAIMER: > > This email (including any attachments) is intended for the sole use > > of the intended recipient/s and may contain material that is > > CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance > > by others or copying or distribution or forwarding of any or all of > > the contents in this message is STRICTLY PROHIBITED. If you are not > > the intended recipient, please contact the sender by email and > > delete all copies; your cooperation in this regard is appreciated. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]