0

I have the following paragraph,

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

<h1>Methodology</h1>

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

<h2>Define Methodology</h2>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi u
t aliquip ex ea commodo consequat.

<h3>Categories of Methodology</h3>

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam.

The above paragraph is the "content" column from the "documents" table in MySql database. I want to do Fulltext search into this paragraph but I want to match the text only between "<h>" tags.

My current Fulltext search query is as follow:

SELECT *
FROM documents
WHERE MATCH(content) AGAINST('How to Define Methodology')
ORDER BY MATCH(content) AGAINST('How to Define Methodology') DESC;

How should I modify this query for search made only between <h> tags? If possible, I don't want to define "Search Index" table for these heading text.

  • If you need to understand html structure, then you should preprocess the text and put it into multiple columns or rows or tables. – Rick James Jun 19 '15 at 0:04
  • @RickJames I think your suggestion is the good way to solve my problem. Let me try it. – Steve.NayLinAung Jun 19 '15 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.