0% found this document useful (0 votes)
6 views7 pages

Query Processing and Types Explained

The document discusses query processing and its types, explaining how users express information needs through queries that search document collections. It outlines various query processing steps, including parsing, translation, and optimization, and describes different query languages such as keyword-based querying, pattern matching, and structural queries. Additionally, it details types of keyword-based querying, including single word, context, boolean, and natural language queries, highlighting their functionalities and applications in information retrieval systems.

Uploaded by

shrihari.mane22
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

Query Processing and Types Explained

The document discusses query processing and its types, explaining how users express information needs through queries that search document collections. It outlines various query processing steps, including parsing, translation, and optimization, and describes different query languages such as keyword-based querying, pattern matching, and structural queries. Additionally, it details types of keyword-based querying, including single word, context, boolean, and natural language queries, highlighting their functionalities and applications in information retrieval systems.

Uploaded by

shrihari.mane22
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 3

Query Processing and Operations


Query and its types: -
• A query is how a user expresses their information need, typically using a
combination of words.
• This query is then used to search through a document collection to find
documents that include the same words.
• Word queries are straightforward and efficient, as they align with natural
language and quickly help to rank relevant documents.
• Single word, multiple word and pattern-based queries are classified as
basic queries.

Query Processing: -
• Query Processing is the activity which is basically performed to extract
data from the database.
• In Query Processing, it takes various steps for fetching the data from the
database.
• The steps involved are: Parsing, Translation and Optimization.
• The queries applied on structured and unstructured data, stored in
databases combined with information retrieval techniques can lead to
faster and efficient processing of data.
• When a database is queried, it generates results using one of the multiple
available plans.
Query Languages: -
Three types of Query Languages are: -
1. Keyword Based Querying
2. Pattern Matching
3. Structural Queries

1. Keyword Based Querying: -

 It is the kind of IR queries which are simplest and most widely used.

 It requires the user to simply enter the phrase combinations to retrieve


documents.

 The majority of times, people look for similar documents in online mode
using keywords.

 A logical AND operator creates an implied connection between the query


keyword terms.

 When searching for “information retrieval” , for example, the first


retrieved results will be documents that contain both the phrases
“information” and “retrieval”.

 Additionally, the majority of systems also retrieve documents that only


contains the words “information” or “retrieval” in them.

 Before delivering the filtered query keywords to the IR engine, some


systems preprocess the data by removing the most frequent words
(stopwords) such as a, the, of and so on. The order of these terms in the
query is typically ignored by IR systems.

 Keyword searches are supported by all retrieval models.


Types of Keywords Based Querying: -
1. Single Word Queries
2. Context Queries
a. Phrase
b. Proximity
3. Boolean Queries
a. OR
b. AND
c. BUT
4. Natural Language
5. Wildcard Queries

1. Single Word Queries


 A query is formulated by a word and a document is formulated by long
sequence of words.
 A word is a sequence of letters surrounded by separators like a period,
comma or space.
 Definition of letter and separator is flexible e.g. hyphen could be defined
as a letter or as a separator. Some characters are not letters but do not split
a word, e.g. hyphen in on-line.
 The division of the text into words is not arbitrary.
 Word queries return a list of documents that contain at least one of the
query words.
 The level of similarity between the returned documents and the query
determines their ranking.
 Term Frequency and Inverse Document Frequency are commonly used to
support ranking.
2. Context Queries
 Many information retrieval systems go beyond basic queries (i.e. single
word or multiple word) and offer the capability to search for words in a
specific context, particularly when they appear near other words.

 Words that are near together suggest a higher possibility of relevance than
words that are far apart.

 Types of Context Queries are:-


a. Phrase
b. Proximity

a) Phrase: -
 For a phrase query, users are looking for a specific sequence of words in a
document.
 In a phrase query, the seperators (like spaces, punctuation) in the text
don’t have to match those in the query exactly.
 For example, search for “enhance retrieval”. The phrase is generally
enclosed within double quotes. It could still match a text containing
“enhance the retrieval” because the system is flexible about the
seperators.
 Common or stopwords (like the and, of) are typically ignored, focussing
on the essential words that make up the phrase.
 Each retrieved document must contain at least one instance of the exact
phrase.

b) Proximity: -
 Proximity specifications in information retrieval are used when you want
to find word or phrases that appear close to each other within a certain
distance in the document.

 Most commonly used proximity search option is a phrase search that


requires terms to be in exact order but it is a more relaxed version of
phrase query.
 This is particularly useful for large documents where the search terms
might appear in different contexts.

 Other proximity operators can specify how close terms should be to each
other. Some will specify the order of search terms.

 Here a sequence of single word or phrases and a maximum allowed


distance between them are specified. This proximity specification helps to
narrow down the search results and improve search precision.

 For example, “enhance retrieval” should occur within 4 words will match
‘….enhance the power of retrieval….’ .

 The word or phrases may or may not be required to appear in the same
order as in the query.

3. Boolean Queries

 Boolean queries are the oldest but still widely used because they offer a
simple and powerful way to combine keywords to retrieve documents.

 Boolean queries give a syntax composed of atoms that retrieve documents


and Boolean operators which work on their operands and deliver set of
documents.

 Some IR systems allow using the AND, OR, NOT, ( ), + and – Boolean
operators in combination of keyword formulations.

 AND: - It retrieves documents that satisfy both conditions. For example,


“cats AND dogs” will return documents mentioning both cats and
dogs.

 OR:- It retrieves documents that satisfy either condition. For example,


“cats OR dogs” will return documents mentioning either cats or dogs or
both.

 NOT: - It excludes documents that contain a specific term. For example,


“cats NOT dogs” will return documents mentioning cats but not dogs.
 Syntax Tree:- Boolean queries can be visualized as a tree structure. Basic
queries are represented at the leaves and the Boolean operators are at the
internal nodes. This tree helps to represent the order of operation for a
complex query.

AND

Translation OR

Syntax syntactic
An example of query syntax tree. It will retrieve all the documents which
contain the word ‘translation’ as well as either the word ‘syntax’ or the
word ‘syntactic’.

 ‘( )’ means the Boolean operators can be nested using paranthesis.

 ‘+’ is equivalent to AND, requiring the term; the ‘+’ should be placed
directly in front of the search term.

 ‘-‘ is equivalent to NOT and means to exclude the term. The ‘-‘ should be
placed directly in front of the search term not wanted.

 Complex Boolean queries can be built out of these operators and their
combinations and they are evaluated according to the classical rules of
Boolean Algebra.

 No ranking is possible because a document either satisfies such a query


(is “relevant”) or does not satisfy it. (is “nonrelevant”).

 So, documents are either retrieved (if they fully match the query) or not
retrieved at all (if they don’t match). There is no in-between or partial
retrieval.
 To overcome this limitation, a ‘fuzzy boolean’ set of operators has been
proposed. The ides is that the meaning of AND and OR can be relaxed,
such that instead of forcing an element to appear in all the operands
(AND) or at least in one of the operands (OR) , they retrieve elements
appearing in some operands.

4. Natural Language

 It is generalization of “fuzzy Boolean”.

 A query is an enumeration of words and context queries.

 Using Natural Language for querying is very attractive.

 Natural language queries are converted to a formal language for


processing against a set of documents.

 All the documents matching a portion of the user query are retrieved.

 Few natural language search engines that aim to understand the structure
and meaning of queries written in natural language text, generally as
question or narrative.

 The system tries to formulate answers for these queries from retrieved
results.

 Semantic model can provide support for this query type.

You might also like