This content has been marked as final. Show 4 replies
Your parser might be just the thing I need!
I have a question though. In one of my queries I'm selecting from two different tables that have two different indices set up. Then I UNION ALL the results.
If I call "exec parser.setIndexName('index');" twice, once with each index name, will your parser work on both indices? Or, is there a way I can call this function before each select?
Example of the unioned query:
(select COUNT(*) OVER () "Count", NestNest.*, ROWNUM rn FROM ( (select score(1) RANK, rowid rid from "Table1" where contains("dummy1", input, 1) > 0 UNION ALL select score(2) RANK, rowid rid from "Table2" where contains("dummy2", input, 2) > 0) order by RANK desc ) NestNest ) Nest
Ah, good question. Hadn't considered that scenario.
The index name is only used to fetch join characters (PRINTJOINS) and stopwords. If you're using the same join characters (or none) and stopword list for each index, then just call it once, the string returned will work fine for both indexes.
If not, then you'll need to call the parser function outside of the query, something like:
Alternatively, you could modify my code so that the index name is passed in as a parameter to each call. That's how I had it originally, but then I moved it to a separate call to make it neater.
search1 varchar2(4000); search2 varchar2(4000); parser.setIndex( 'myindex1' ); search1 := parser.simpleSearch( input ); parser.setIndex( 'myindex2' ); search2 := parser.simpleSearch( input ); select score(1), ... where contains( dummy1, search1, 1 ) > 0 UNION ALL select score(2), ... where contains( dummy2, search2, 2 ) > 0
Edited by: Roger Ford on Feb 22, 2013 4:25 AM