Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.2k views
in Q2A Core by
I was wondering if the reindex from the admin panel has to be done frequently or if it should be taken care of automatically when new questions/answers/comments are added.

What raises my questions is that I've created a page to import question from a CSV file. It works fine, but search results are better after I manually do a reindex. I use $postid =qa_question_create(null, $questionuserid, null, null, $questiontext, $questiondetail, '', null,$questiontags, false, null,$questioncategoryid); and   $answerid=qa_answer_create($answeruserid, null, null, $sampleanswer,'',null, false, null, $question);   which I thought would take care of the indexing stuff for me.

For now, I just run a reindex after the import, but I want to be sure searching on my site is always working fine.

2 Answers

+1 vote
by
edited by

As far as I can tell, all operations that are done through the Q2A software (i.e. on site) like asking, answering and editing*, will update the index. So in most cases you shouldn't ever need to do a reindex.

Furthermore if you have a large question set, reindexing takes a heck of a long time. When I updated to 1.3 it took hours to reindex all the posts (5k questions, 10k answers, 10k comments).

However, if you are importing questions directly into MySQL as you mention, then you are not changing the index tables so a reindex will always be necessary.

 

* P.S. I'm not sure how indexing is done with question edits, since the way Q2A's index works means that the old post would have to be de-indexed before the new one is saved. I noticed that some words in the qa_words table are not actually used anywhere.

by
Edits are indexed correctly too. It's true that a word can remain in the qa_words table even if it's no longer used, but that won't affect search results.
by
One more use of indexing I remembered - it is simpler to ignore the qa_contentwords and qa_words when backing up because the tables are so large. So you can do that then manually reindex when you restore a backup.
0 votes
by

As DisgruntledGoat said, all operations performed via Q2A's web interface are correctly indexed. You only need to reindex if you've been manually modifying content in the database, or if you know something has gone wrong. Check out the new functions in qa-app-posts.php for an easier way to create content that takes care of indexing for you.

...