Full Database Search
Full database search is about scanning your complete system for single items and facts, such as scanning for
"sue" whether this means a Customer, Staff Member, or even part of a reference number. The meaning of search is not just
to find the items, but also to allow exploration of connections from the items found.
This page contains technical information for developers who wish to search and process the results, not end users
Jump to: Concepts | Worked Example
Concepts
Full search detachs from normal database models in order to scan every field and row (where enabled) and find
results. The following key concepts are important to understand full search.
DataNode
When you search for a string, the search engine returns "DataNodes" which represent the individual items found.
SearchGroup
DataNodes are usually returned in groups, such that the engine returns a group of customers and a group of products. Typically when
searching, only a finite number will be returned for each group.
NLQ
There are two main types of search, data search and information search. Data Search is about finding values in the data,
such as "sue" or even "7.95". An alternative type of search is "sales to sue", which is a desire to see a list of the sales made to
sue. This second query is no longer searching for the exact string but rather the idea of what is required. This second type of
search is named "NLQ", or natural language query within the search engine.
Context
When searching you often have context to pass to the search engine. Context assists the search engine by giving hints as to what
the user is expecting based on where they are in the system or even who they are. This context information is typically not part of the query string entered by the user directly
Relationship
Individual items can relate to other items where they have a common connection. The search engine can search a large number of relationships
automatically and return "connected" or "related" datanodes. For example, if we are looking at the single customer "sue", we can return related data such as
- Other customers/staff members/supplies/products named "sue".
- Sales transactions made by "sue" (using her Customer#)
- Geographic/Demographic information (using her address)
Not all related data will be useful or be relevant in all circumstances. Relationships between data are created using universal domains
Universal Domain
A universal domain defines what a database field is holding, rather than how. How is defined using database types such as
string, number, date etc. Universal domains hold the fact that this field holds a "name" or "description" or "Customer#", or "monetary total" or "telephone number", and
so on. Tables the have fields with corresponding universal domains may then be related (although it is more complex than this simple mapping).
Universal domains are defined at the global level (address, description), or at the database level for concepts that are only valid within the database.
Properly assigned,
universal domains allow you to rapidly extend a database to global data. For example, you can take "address" in the database, map it to the global domain "street-address" and
potentially retrieve demographic information for this address.
Worked Example
- Collect the search string from the user ("qu" in this example)
- Construct a request to the URL /gnap/srch?1=qu&11=qu (for XML results) or /gnap/j/srch?1=qu&11=qu (for JSON results)
- The server will respond with the following information (shown in stylised/editted XML)
<ARAY>
<SGRP>
<f24>Staff</f24>
<SITM>
<f71>pos_teller</f71>
<f23>Jacqui</f23>
<f70>bretailmax.elink.staff.list$f100,0,107</f70>
<f72>Jacqui</f72>
</SITM>
</SGRP>
<SGRP>
<f24>Products</f24>
<SITM>
<f71>pos_product</f71>
<f23>DISHWASH LIQUID CHAMOMILE</f23>
<f74>/report/pos/stock/fieldpine/singlepid.htm?pid=6036</f74>
<f70>bretailmax.elink.products$f100,0,6036</f70>
<f72>DISHWASH LIQUID CHAMOMILE<br>PLU: 8001</f72>
<f100>6036</f100>
<f101>DISHWASH LIQUID CHAMOMILE</f101>
<f103>8.990000</f103>
<f104>4</f104>
<f105>8001</f105>
<f106>3</f106>
</SITM>
<SITM>
<f71>pos_product</f71>
<f23>TEA FENNEL LIQUORICE</f23>
<f74>/report/pos/stock/fieldpine/singlepid.htm?pid=6286</f74>
<f70>bretailmax.elink.products$f100,0,6286</f70>
<f72>TEA FENNEL LIQUORICE<br>PLU: 8721</f72>
<f100>6286</f100>
...
- .....
Typically, you will want to retrieve more information about a single search result datanode. The search engine
allows you to take a single datanode and request what it is connected too, which is a relationship.
- Take the datanode key, which is returned in "f70" of the SITM packet. for example "bretailmax.elink.products$f100,0,6036"
- Construct a query of the form /gnap/srch?70=bretailmax.elink.products$f100,0,6036 (for XML) or /gnap/j/srch?70=bretailmax.elink.products$f100,0,6036 (for JSON)
- The server will return with the following results (shown in stylised/editted XML)
<ARAY>
<APPD>
<f100>6036</f100>
<f101>DISHWASH LIQUID CHAMOMILE</f101>
<f103>8.990000</f103>
<f104>4</f104>
<f105>8001</f105>
<f106>3</f106>
<f108>5.040000</f108>
</APPD>
<DMER>
<f10>IR39JPVDRI8OGQA.5000</f10>
<f200>Product Id</f200>
<f71>Barcodes</f71>
<APPD>
<f100>5412533002010</f100>
<f101>6036</f101>
<f102>1</f102>
<f110>1</f110>
<f120>Product</f120>
</APPD>
<APPD>...</APPD>
<APPT/>
</DMER>
<DMER>
<f10>IR39JPVDRI8OGQA.5000</f10>
<f200>Product Id</f200>
<f71>Sales</f71>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPD>...</APPD>
<APPT/>
</DMER>
<DMER>
<f11>7</f11>
<f200>Money Total</f200>
<f71>Products</f71>
<APPD>...</APPD>
<APPD>
<f71>pos_product</f71>
- The search results show
- If we search for barcodes connected to the product, there are two
- If we search for sales of this product, there are many (first few returned)
- If we search for products with the same retail price, there are several
- If we search for products from this same supplier, there are several