Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:56:49+00:00 2026-06-12T15:56:49+00:00

How do i do (title)? I’ve looked at the plugin docs on http://brian.io/lawnchair/plugins/ and

  • 0

How do i do (title)?

I’ve looked at the plugin “docs” on http://brian.io/lawnchair/plugins/
and with that i could see doing a search for equality, but i dont see something for .indexOf()

use case:
I want to search my db of articles for every article containing the keyword “obama”
at the minimum i’d like to see every article object with “obama” in the body field of the article.

If having keywords associated with each article would help i could add that in too, my main problem atm is just doing the search.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:56:50+00:00Added an answer on June 12, 2026 at 3:56 pm

    I ended up using regular expressions and iterating over the whole database:
    If anyone has a better idea, or cleaner code, feel free to contribute.

    var lawnchair = Lawnchair({name:'lawnchair'},function(e){
                console.log('storage open');
            });
    
     $('#search').click(function(e) {
                var search_term = $("#search_field").val();
                var search_type = $('#search_type').val(); 
                var re = new RegExp(search_term, "gi")
                console.log("startings search for "+search_term);
                console.log("startings search for "+re.toString());
                lawnchair.all(function(articles){
                    $('#article_list').empty();
                    console.log(articles.length);
                    var counter = 0;
                    for(var i = 0; i<articles.length;i++)
                    {
                        cur_a = articles[i].value;
                        if(cur_a["title"] != null){
                            var thing_to_search = "string";
                            if(search_type == "both"){
                                thing_to_search = cur_a["title"]+" "+cur_a["body"];
                            }else if(search_type == "title"){
                                thing_to_search = cur_a["title"];
                            }else if (search_type == "body"){
                                thing_to_search = cur_a["body"];
                            }
                            var matches = thing_to_search.match(re);
                            if (matches != null) 
                            {
                                counter = counter + 1;
                                var lyo = make_article_layout();
                                lyo.find("#title").text(cur_a["title"]);
                                //xrank is the kw density
                                //let title be 10x more important than body
                                var xrank = (1.0 * matches.length) / thing_to_search.length;
                                if(cur_a["title"] != null){
                                    var m2 = cur_a["title"].match(re);
                                    if(m2 != null){
                                        xrank = (xrank * m2.length)
                                    }
                                }
                                lyo.find("#match_count").text(matches.length.toString());
                                lyo.find("#xrank").text(xrank.toString());
                                console.log(cur_a["title"]);
                                //console.log(cur_a["body"]);
                                lyo.id = cur_a["_id"];
                                //lyo.find("#body").text(cur_a["body"]);
                                lyo.find("#published_at").append(" "+cur_a["published_at"]);
                                lyo.find("#author").append(" "+cur_a["author"]);
                                lyo.find("#source").append(" paper_id:"+cur_a["paper_id"]+" | "+cur_a["url"]);
                            }
                        }
                    }
                    $('#status').text("Results Found:"+counter.toString())
                });
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Title edits that reflect a better summary of the question are welcome. I'd like
Title said it all. Some context: I got a search mechanism - search view,
(Title and contents updated after reading Alex's answer) In general I believe that it's
(Title updated to indicate that problem was with _wgetenv) The following program fails with
Title does justice. I'm building an application that uses TPL instead of Backgroundworker, but
The title of the projects has a border-bottom on hover, I want that it
Title more or less says it all. Specifically, I've become increasingly annoyed that in
Title says most of it. I have a div container that holds all the
Title explains the question. How can I easily do that?
Title explains. I have native C++ dlls that I'm writing C++/CLI wrappers for, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.