3

I'm working on analyzing texts in RQDA and am using the Firefox SQLite Manager to access the database so that I can search files more easily. I've created and populated virtual table:

CREATE VIRTUAL TABLE texts USING fts4(filename, content)

Then I did a snippet search

SELECT snippet(texts, '_', '_', '...') FROM texts WHERE texts MATCH 'great OR Great'; 

This returns results where the snippet term is highlighted with an underscore.

My questions:

  1. How do I implement the 6th argument (documentation) so to increase the snippet size? (I see a similar question on this but the response does not work.)
  2. How can I get the MATCH return to also show the filename for the snippet (first column in my table.) So the format will be "filename", "snippet".

Thanks in advance for your help.

1
  • Okay so I figured out the answer to question #2: SELECT filename, snippet(texts, '_', '_', '...') FROM texts WHERE texts MATCH 'great'; Commented Nov 22, 2016 at 4:57

1 Answer 1

1

So I figured it out! Documentation on 6th parameter was not so clear...

SELECT filename, snippet(texts, '_', '_', '...', -30, 30) FROM texts WHERE texts MATCH 'great OR Great';

This displays the filename and snippet with 30 words before and after search term.

Sign up to request clarification or add additional context in comments.

2 Comments

how can I remove ellipsis at the first? how to show the response from the beginning?
The answer uses the wrong 5th argument, -30, which is the column number to search for. A negative value of -1 means to search in every column. Docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.