How to Form a Query

Querying an Index with Egothor. 

Egothor is written in such a way as to recognized a number of different query forms. Here is a sample of various queries that range from simple keyword queries to queries with complex Boolean forms.

  1. Simple Queries

    Just write keywords that are most characteristic to information you want to find.

    Example 3.1. Keyword Query

    hockey nagano

    Return pages that contain "hockey", "nagano", or both.

  2. Simple Restrictions

    Use a "+" for keywords that must be in pages the engine returns as hits. To exclude terms, use a "-".

    Example 3.2. Using Restrictions

    +nagano -hockey

    The pages returned must contain "nagano", but not "hockey".

  3. Simple Boolean Queries

    You can use Boolean queries for precise querying.


    Remember, you must use brackets around boolean queries. If you forget them, the engine will report a syntax error.

    Example 3.3. Simple Boolean AND Query.

    (hockey && nagano)

    Return only pages containing both "hockey" and "nagano".

    Example 3.4. Simple Boolean OR Query

    (hockey || nagano)

    Return pages that contain "hockey" or "nagano".

    Example 3.5. Multiple Boolean Query

    (czech && (hockey || nagano))

    Return pages that contain "czech" and either "hockey" or "nagano".

    Example 3.6. Simple Boolean NOT Query

    (hockey - nagano)

    Return pages containing "hockey" but not "nagano".

    • && (double "and") denotes logical AND

    • || (double "pipe"/"or") denotes logical OR

    • - (single "minus") denotes logical NOT

  4. Long Boolean Queries

    You may use a number of simple Boolean queries in one query.

    Example 3.7. Long Boolean Query

    (hockey && nagano) (atlas || cern)

    This is (logically) equivalent to:

    ((hockey && nagano) || (atlas || cern))

    but the relevance of hits may differ. The first sample is taken as "we have two boolean queries that are independent and both talking about the same thing...", but the second one means that the keywords are dependent.

  5. Simple Queries in a Boolean Query

    It is possible to use simple queries within Boolean ones.

    Example 3.8. Simple Query with Boolean Query

    hockey nagano (atlas && cern)

    Example 3.9. Simple Query with Restrictions in a Boolean Query

    You may even use restrictions.

    +hockey nagano (atlas && cern)

    and restriction for Boolean parts:

    +hockey nagano +(atlas && cern)

  6. Phrases

    When you want hits with a particular phrase surround the phrase with curly braces.

    Example 3.10. Phrase Syntax

    {Charles University}

    This will find all occurences of "Charles University" and "University Charles".

    When you want to allow up to n words between the two words, i.e. n=4, use square brackets to surround your query.

    Example 3.11. Proximity Syntax

    [Charles 4 University]

    This will return only pages where the words "Charles" and "University" occur within 4 words of each other.

  7. Query Term Boost Factors

    Egothor can apply a boost factor which will inform the engine that the searcher has more of an interest in one term over another when multiple queries are made. The boost factor can be any integer

    Example 3.12. Querying with Boost Factors Syntax

    hockey nagano^^2

    This will tell Egothor that you are more concerned with results containing "nagano" than "hockey".

  8. Specific Language Query

    You can limit your query to documents in a specific language. The language is gotten in indexing by reading a document's metadata. Multiple languages can be queried, and this form can be used in combination with all other forms.

    Example 3.13. Querying for Documents in a Specific Language Syntax

    Tour de France <SRC>fr-fr

    This will tell Egothor to look for documents in French about the Tour de France.

  9. Webspace Specific Query

    Sometimes you want to know if a particular document resides in a particular webspace on a server. A query using this syntax will allow you to check just that.

    Example 3.14. Webspace Specific Query Syntax


    This tells Egothor to limit the query to documents to the "somis" webspace on the Dundee server.

  10. All in one

    Example 3.15. Multiple Query Form Syntax

    {Charles University} +(homepage && {Jaroslav Pokorny})

Prev Up Next
Chapter 3. Querying Your Index Home Querying via the Egothor Webapp
© 2003-2004 Egothor Developers