Presentation is loading. Please wait.

Presentation is loading. Please wait.

Query processing: phrase queries and positional indexes

Similar presentations


Presentation on theme: "Query processing: phrase queries and positional indexes"— Presentation transcript:

1 Query processing: phrase queries and positional indexes
Prof. Paolo Ferragina, Algoritmi per "Information Retrieval" Query processing: phrase queries and positional indexes Paolo Ferragina Dipartimento di Informatica Università di Pisa

2 Sec. 2.4 Phrase queries Want to be able to answer queries such as “stanford university” – as a phrase Thus the sentence “I went at Stanford my university” is not a match.

3 Solution #1: 2-word indexes
Sec Solution #1: 2-word indexes For example the text “Friends, Romans, Countrymen” would generate the biwords friends romans romans countrymen Each of these 2-words is now an entry in the dictionary Two-word phrase query-processing is immediate.

4 Can have false positives!
Sec Longer phrase queries Longer phrases are processed by reducing them to bi-word queries in AND stanford university palo alto can be broken into the Boolean query on biwords, such as stanford university AND university palo AND palo alto Need the docs to verify + They are combined with other solutions Can have false positives! Index blows up

5 Solution #2: Positional indexes
Sec Solution #2: Positional indexes In the postings, store for each term and document the position(s) in which that term occurs: <term, number of docs containing term; doc1: position1, position2 … ; doc2: position1, position2 … ; etc.>

6 Processing a phrase query
Sec Processing a phrase query “to be or not to be”. to: 2:1,17,74,222,551; 4:8,16,190,429,433; 7:13,23,191; ... be: 1:17,19; 4:17,191,291,430,434; 5:14,19,101; ... Same general method for proximity searches

7 Sec Query term proximity Free text queries: just a set of terms typed into the query box – common on the web Users prefer docs in which query terms occur within close proximity of each other Would like scoring function to take this into account – how?

8 Positional index size You can compress position values/offsets
Sec Positional index size You can compress position values/offsets Nevertheless, a positional index expands postings storage by a factor 2-4 in English Nevertheless, a positional index is now commonly used because of the power and usefulness of phrase and proximity queries … whether used explicitly or implicitly in a ranking retrieval system.

9 Sec Combination schemes 2-Word + Positional index is a profitable combination 2-word is particularly useful for particular phrases (“Michael Jackson”, “Britney Spears”) More complicated mixing strategies do exist!

10 Soft-AND E.g. query rising interest rates
Sec Soft-AND E.g. query rising interest rates Run the query as a phrase query If <K docs contain the phrase rising interest rates, run the two phrase queries rising interest and interest rates If we still have <K docs, run the “vector space query” rising interest rates (…see next…) “Rank” the matching docs (…see next…)

11 Caching for faster query
Prof. Paolo Ferragina, Algoritmi per "Information Retrieval" Caching for faster query Two opposite approaches: Cache the query results (exploits query locality) Cache pages of posting lists (exploits term locality)

12 Tiered indexes for faster query
Sec Tiered indexes for faster query Break postings up into a hierarchy of lists Most important Least important Inverted index thus broken up into tiers of decreasing importance At query time use top tier unless it fails to yield K docs If so drop to lower tiers

13 Sec Example tiered index

14 Query processing: optimizations
Prof. Paolo Ferragina, Algoritmi per "Information Retrieval" Query processing: optimizations

15 Skip pointers (at indexing time)
Sec. 2.3 Skip pointers (at indexing time) 41 128 128 2 4 8 41 48 64 11 31 1 2 3 8 11 17 21 31 How do we deploy them ? Where do we place them ?

16 Sec. 2.3 Using skips 41 128 2 4 8 41 48 64 128 11 31 But the skip successor of 11 on the lower list is 31, so we can skip ahead past the intervening postings. 1 2 3 8 11 17 21 31 Suppose we’ve stepped through the lists until we process 8 on each list. We match it and advance. We then have 41 and 11 on the lower. 11 is smaller.

17 Placing skips Tradeoff:
Sec. 2.3 Placing skips Tradeoff: More skips  shorter spans  more likely to skip. But lots of comparisons to skip pointers. Fewer skips  longer spans  few successful skips. Less pointer comparisons.

18 Placing skips Simple heuristic for postings of length L
Sec. 2.3 Placing skips Simple heuristic for postings of length L use L evenly-spaced skip pointers. This ignores the distribution of query terms. Easy if the index is relatively static. This definitely useful for in-memory index The I/O cost of loading a bigger list can outweigh the gains!


Download ppt "Query processing: phrase queries and positional indexes"

Similar presentations


Ads by Google