M.J. van der Veen
2007-Jan-14 21:36 UTC
[Xapian-discuss] Indexing & Querying multiple fields
Hi, After a lot of trial and error have still not figured out how to add multiple fields, and indices. Let me explain with an example index file for omega scriptindex: userid : boolean=Q unique=Q field=userid username : lower field=username index=XU name : lower field=name index=XN city : lower field=city index=XC province : boolean=XPR gender : boolean=XG avatar : boolean=XP birthday : boolean=D birthmonth : boolean=M birthyear : boolean=Y birthdate : value=1 birthdaterange : date=yyyymmdd user : value=2 question : weight=3 lower index text : unhtml lower index style : boolean=XS I want to be able to search with the P variable the fields 'text' and 'question'. With this index file, only indexed words from the 'text' variable can be somehow and now the words from the question variable. Even though they are all correctly imported. Secondly, I want to be able to search name, username and city probabilistically. I'm not sure if I'm doing this right, but I thought that "P = XUmaarten" would allow me to probabilistically search the username field? Nonetheless, it's not working. You can question whether I should make these fields boolean, but my database contains multiple words for name and city, so boolean search is not really effective. Last and final question. I've been unable to search ranges with the D, M, and Y booleans. so I added a date=yyymmdd field aswell. Are these other booleans still good for anything except searching for a specific day, month or year? Any help is appreciated! Cheers, Maarten
On Sun, Jan 14, 2007 at 10:36:13PM +0100, M.J. van der Veen wrote:> I want to be able to search with the P variable the fields 'text' and > 'question'.Then the following two lines look reasonable:> question : weight=3 lower index > text : unhtml lower indexThe "lower" action probably isn't wanted, unless you want to disable the generation of R-prefixed terms for capitalised words. The "index" action handles case conversion of the terms it generates.> With this index file, only indexed words from the 'text' variable can > be somehow and now the words from the question variable.Sorry, I don't understand what you're saying here.> Secondly, I want to be able to search name, username and city > probabilistically. I'm not sure if I'm doing this right, but I thought > that "P = XUmaarten" would allow me to probabilistically search the > username field? Nonetheless, it's not working.You need to add something like $setmap{prefix,user,XU} to your query template, and then you can use user:maarten in the P parameter. See termprefixes.txt in the Omega docs for details - you want to read the section "Probabilistic Fields": http://svn.xapian.org/trunk/xapian-applications/omega/docs/termprefixes.txt?view=co> Last and final question. I've been unable to search ranges with the D, > M, and Y booleans. so I added a date=yyymmdd field aswell.What did you put in your D and M terms? For the date range searching to work, D must give the year and month, and M the year - e.g. for today, the terms are: D20070115 M200701 Y2007 If you were adding D15 M01 Y2007 then the daterange searching wouldn't work.> Are these other booleans still good for anything except searching for > a specific day, month or year?No. Cheers, Olly