Forum Moderators: coopster

Message Too Old, No Replies

Sorting Array

Variable contains inverted Index Data

         

maneeshji

11:35 am on Dec 6, 2007 (gmt 0)

10+ Year Member



Hi

i am developing one text based search engine of around 10 Million pages with AND OR NOT and PHRASE feature.

in database i have stored like following

Word1 (docid,occurance,position1-position2-position3..)

when searched i got results like

(31154,2,32-56) (31242,3,89-47-90)

i am stucked here..... outta mind how to sort it as per the occurance.

Any suggestion is welcomed

thanks in advance

-----------------------------------------------------------------------------
Work like you don't need money,
Love like you've never been hurt,
And dance like no one's watching

cameraman

4:57 pm on Dec 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It would be a whole lot better if you put the occurence in its own field.
As it is, you could use usort() [php.net].
Your callback function would use either explode or a regular expression to pull the occurrences out for comparison.
It would be pretty slow - is why the separate field would be preferable.

maneeshji

5:06 am on Dec 7, 2007 (gmt 0)

10+ Year Member



Hi thanks for the reply...

its like that

Abatement (doc1,2,13-19) (doc2,1,17) (doc3,2,21-22)

when my indexer runs it index the words. Lets say it found abatement in doc4 so the entry would be like this

Abatement (doc1,2,13-19) (doc2,1,17) (doc3,2,21-22) (doc4,1,54)

again if i make some changes and append abatement in doc 3 then entry would be like this

Abatement (doc1,2,13-19) (doc2,1,17) (doc3,3,21-22-27) (doc4,1,54)

so putting all the things in one field would be better

my view