Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
548 views
in Plugins by
I added an extra fields box called "Case" and want to be able to use the search box to search input from that field. Can this be done and if so, how can I incorporate this?
Q2A version: 1.7

1 Answer

0 votes
by
To accomplish this, I added the following bit of code to the qa-eqf-event.php file after the line qa_db_postmeta_set($params['postid'], 'qa_q_'.$name, $content);

 

$contentcount=array_count_values(qa_string_to_words($content));
                        //      Map all words to their word IDs
                        $words=array_unique(array_keys($contentcount));
                        $wordtoid=qa_db_word_mapto_ids_add($words);
                        //      Add to content words index (including word counts)
                        $contentwordidcounts=array();
                        foreach ($contentcount as $word => $count)
                                if (isset($wordtoid[$word]))
                                        $contentwordidcounts[$wordtoid[$word]]=$count;
                        qa_db_contentwords_add_post_wordidcounts($params['postid'], 'Q', $params['postid'], $contentwordidcounts);

 

This allows any of the Extra Fields sections to be searchable. However, this will not allow old posts Extra Fields to be searchable, only new posts from the time of adding this code.
...