Reverse querying
Hello, I have problem which I am trying to solve using solr. I have search text (term) and I have index full of words which are mapped to ids. Is there any query that I can run to do this? Example: Term "3) A recommendation to use VAR=value in the configure command line will not work with some 'configure' scripts that comply to GNU standards but are not generated by autoconf. " Index docs id:1 name:recommendation ... id:3 name:GNU id:4 name food after running "query" I want to get as results 1 and 3 Thanks -- View this message in context: http://www.nabble.com/Reverse-querying-tp24194777p24194777.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reverse querying
Otis Gospodnetic wrote: > > > Alex & Oleg, > > Look at MemoryIndex in Lucene's contrib. It's the closest thing to what > you are looking for. What you are describing is sometimes referred to as > "prospective search", sometimes "saved searches", and a few other names. > > Otis > -- > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch > > > > - Original Message >> From: AlexElba >> To: solr-user@lucene.apache.org >> Sent: Wednesday, June 24, 2009 7:47:20 PM >> Subject: Reverse querying >> >> >> Hello, >> >> I have problem which I am trying to solve using solr. >> >> I have search text (term) and I have index full of words which are mapped >> to >> ids. >> >> Is there any query that I can run to do this? >> >> Example: >> >> Term >> "3) A recommendation to use VAR=value in the configure command line will >> not work with some 'configure' scripts that comply to GNU standards >> but are not generated by autoconf. " >> >> Index docs >> >> id:1 name:recommendation >> ... >> id:3 name:GNU >> id:4 name food >> >> after running "query" I want to get as results 1 and 3 >> >> Thanks >> >> -- >> View this message in context: >> http://www.nabble.com/Reverse-querying-tp24194777p24194777.html >> Sent from the Solr - User mailing list archive at Nabble.com. > > > Hello, I looked into this MemoryIndex, there search is returning only score. Which will mean is it here or not I build test method base on example Term: " On my last night in the Silicon Valley area, I decided to head up the east side of San Francisco Bay to visit Vito’s Pizzeria located in Newark, California. I have to say it was excellent! I met the owner (Vito!) and after eating a couple slices I introduced myself. I was happy to know he was familiar with the New York Pizza Blog and the New York Pizza Finder directory. Once we got to talking he decided I NEEDED to try some bread sticks and home-made marinara sauce and they were muy delicioso. I finished off my late night snack with a meatball dipped in the same marinara. " Data {Silicon Valley, New York, Chicago} public static void find(String term, Set data) throws Exception { Analyzer analyzer = PatternAnalyzer.EXTENDED_ANALYZER; MemoryIndex index = new MemoryIndex(); int i = 0; for (String str : data) { index.addField("bn" + i, str, analyzer); i++; } QueryParser parser = new QueryParser("bn*", analyzer); Query query = parser.parse(URLEncoder.encode(term, "UTF-8")); float score = index.search(query); if (score > 0.0f) { System.out.println("it's a match"); } else { System.out.println("no match found"); } // System.out.println("indexData=" + index.toString()); } no match found What I am doing wrong? Thanks, Alex -- View this message in context: http://www.nabble.com/Reverse-querying-tp24194777p24208522.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Reverse querying
Any other suggestion this suggestion doesn't loook to work AlexElba wrote: > > > Otis Gospodnetic wrote: >> >> >> Alex & Oleg, >> >> Look at MemoryIndex in Lucene's contrib. It's the closest thing to what >> you are looking for. What you are describing is sometimes referred to as >> "prospective search", sometimes "saved searches", and a few other names. >> >> Otis >> -- >> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch >> >> >> >> - Original Message >>> From: AlexElba >>> To: solr-user@lucene.apache.org >>> Sent: Wednesday, June 24, 2009 7:47:20 PM >>> Subject: Reverse querying >>> >>> >>> Hello, >>> >>> I have problem which I am trying to solve using solr. >>> >>> I have search text (term) and I have index full of words which are >>> mapped to >>> ids. >>> >>> Is there any query that I can run to do this? >>> >>> Example: >>> >>> Term >>> "3) A recommendation to use VAR=value in the configure command line will >>> not work with some 'configure' scripts that comply to GNU standards >>> but are not generated by autoconf. " >>> >>> Index docs >>> >>> id:1 name:recommendation >>> ... >>> id:3 name:GNU >>> id:4 name food >>> >>> after running "query" I want to get as results 1 and 3 >>> >>> Thanks >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Reverse-querying-tp24194777p24194777.html >>> Sent from the Solr - User mailing list archive at Nabble.com. >> >> >> > > Hello, > I looked into this MemoryIndex, there search is returning only score. > Which will mean is it here or not > > I build test method base on example > > Term: > " > On my last night in the Silicon Valley area, I decided to head up the east > side of San Francisco Bay to > visit Vito’s Pizzeria located in Newark, California. I have to say it was > excellent! > I met the owner (Vito!) and after eating a couple slices I introduced > myself. > I was happy to know he was familiar with the New York Pizza Blog and the > New York Pizza Finder directory. > Once we got to talking he decided I NEEDED to try some bread sticks and > home-made marinara > sauce and they were muy delicioso. I finished off my late night snack > with a meatball dipped in the same marinara. > " > > Data {Silicon Valley, New York, Chicago} > > > public static void find(String term, Set data) throws Exception > { > > Analyzer analyzer = PatternAnalyzer.EXTENDED_ANALYZER; > MemoryIndex index = new MemoryIndex(); > int i = 0; > for (String str : data) { > index.addField("bn" + i, str, analyzer); > i++; > } > QueryParser parser = new QueryParser("bn*", analyzer); > Query query = parser.parse(URLEncoder.encode(term, "UTF-8")); > float score = index.search(query); > if (score > 0.0f) { > System.out.println("it's a match"); > } else { > System.out.println("no match found"); > } > // System.out.println("indexData=" + index.toString()); > > } > > no match found > > > What am I doing wrong? > > Thanks, > Alex > -- View this message in context: http://www.nabble.com/Reverse-querying-tp24194777p24261892.html Sent from the Solr - User mailing list archive at Nabble.com.