xernt.com




Xernt helps you find up-to-date answers & allows to take a part in building human knowledge database.
This Post below ↓ is only visible to you.
It is sheduled to delete with all the changelog & comment data attached. You can cancel deletion at any time.
4 weeks left
TIP. Editing item cancels the deletion shedule automatically.
FULLTEXT SEARCH, sql fulltext

FULLTEXT SEARCH, sql fulltextEdit

 
 
You want to fulltext search, sql fulltext search combined TITLE (t) and TEXT (text) from articles.

You've got on a start code, like this (similar):
$q = q('SELECT id,t FROM `'.PRFX.'knowledge` WHERE text LIKE "%'.$GET.'%" or t LIKE "%'.$GET.'%" ORDER BY id DESC');

You simply make on:
$q = q('SELECT id,t,MATCH(t,text) AGAINST(\'+('.$GET.') IN BOOLEAN MODE\') AS score FROM `'.PRFX.'knowledge` WHERE MATCH(t,text) AGAINST (\'+('.$GET.') IN BOOLEAN MODE\') ORDER BY score DESC');

Where you want need to remember, to do in MySQL (* MYISAM), set FULLTEXT for those 2 fields (t, text) like on the image below:

sql fulltext

In text retrieval, full text search refers to a technique for searching a computer-stored document or database. In a full text search, the search engine examines all of the words in every stored document as it tries to match search words supplied by the user. Full text searching techniques became common in online bibliographic databases in the 1970s[verification needed]. Many web sites and application programs (such as word processing software) provide full-text search capabilities. Some web search engines such as AltaVista employ full text search techniques while others index only a portion of the web pages examined by its indexing system.[1] Fulltext search, sql fulltext.

Indexing

When dealing with a small number of documents it is possible for the full-text search engine to directly scan the contents of the documents with each query, a strategy called serial scanning. This is what some rudimentary tools, such as grep, do when searching.
However, when the number of documents to search is potentially large or the quantity of search queries to perform is substantial the problem of full text search is often divided into two tasks: indexing and searching. The indexing stage will scan the text of all the documents and build a list of search terms, often called an index, but more correctly named a concordance. In the search stage, when performing a specific query, only the index is referenced rather than the text of the original documents. fulltext search, sql fulltext
The indexer will make an entry in the index for each term or word found in a document and possibly its relative position within the document. Usually the indexer will ignore stop words, such as the English "the", which are both too common and carry too little meaning to be useful for searching. Some indexers also employ language-specific stemming on the words being indexed, so for example any of the words "drives", "drove", or "driven" will be recorded in the index under a single concept word "drive".

source: en.wikipedia.org/wiki/Full_text_search
Edit
Comment  · 2 years ago
Please login or create an account to post a comment.
Follow Post
Related Posts
2,279 views


 
 
146 online
About · Blog · Explore · Privacy · Terms · Help  up

These items will be permanently deleted and cannot be recovered. Are you sure?