Git Product home page Git Product logo

ghosthunter's People

Contributors

bryant1410 avatar cjsheets avatar dependabot[bot] avatar fbennett avatar i11ume avatar jameshome avatar johnonolan avatar kevinansfield avatar mariodian avatar trojanh avatar windyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghosthunter's Issues

Variable "tag" and Empty search-field

"The result template has access to these variables: title, description, link, pubDate."
Is possibile somehow to acess "tags" too?

My main problem is another, i would like to show "all results" when search-field is empty.
I mean,
after I search for something I would like that by deleting progressively the value in the input, I show all the posts, is it possible?

Still no results

#57 & #11

Hi, I'm still getting no results through. I've just updated my Ghost CLI and upgraded to v.1.23.0 (current latest). No JS errors and ghostHunter: init from the console log.

I think I'm at the limit of my knowledge here, so any pointers would be appreciated.
cheers.

[Question] Does this search body as well as titles?

Looking at many ghost installations, their search only runs through the blog titles. While based on the screenshot it would appear that this does indeed also search post content, I wanted to make sure before I dived in to installing this.

Sorry if this is written clearly somewhere, scanning through the content I saw no mention of what exactly is indexed

Bower

Please add this plugin (package) in the Bower. This will help save time during development.

Incoherent results from search after 0.5.0 due to levenstein distance

Hello,
I updated ghostHunted on a theme that I own and I get strange results with a fresh install. When we install a fresh ghost it comes with some posts.

If I search for 'Administrators' I get the page 'http://localhost:2368/managing-users/' that has the word 'Administrators' in the content.
If I search 'Editors can do' I get the page 'http://localhost:2368/the-editor/' that doesn't have this sentence in it. It does have 'editor' in title. I should've got the same page as for 'Administrators': 'http://localhost:2368/managing-users/'

What exactly does the new version parse. Is it the titles or the content? And how does the parsing works?

Thanks.

Query search link and render tag

Hi, I opened this topic for two reasons.

Ghosthunter seems to work properly.

But i would like to do something like this:
https://myblog.com/?search=value

Then display all the results linked to that value.
I tried to search on the web but it is not entirely clear how to do it.

It is possibile to do?


Regarding the "tag", I noticed that in js we have:

         this.field ('title');
         this.field ('description');
         this.field ('plaintext');
         this.field ('pubDate');
         this.field ('tag');
         ........

{{title}}, {{description}} and others work properly.
I wish I could render the tags this way, {{tag}}, but it does not work.
How can I do?

Thanks in advance.

How to get more data? Such as image, content and more

怎么获取更多数据?比如image、content等等
How to get more data? Such as image, content and more?
我想在搜索结果中展示文章焦点图
I want to show the focus image of the article in the search results

Search System not working/Expanding Search System?

Hello, I own a site called IAskMuslim.com, and we have been having problems with your search system. The first problem is that when someone searches something on the site itself many of the public discussions never show up. Any idea how I can make so for example if someone types "Muslim" it would show all of the posts with the word Muslim in it? Another thing, I was going to ask you guys is do you have any plans on advancing the Search System itself.

To work something like this.
https://vanillaforums.org/search

Only searching recent posts

Thanks for this solution. Was very straight forward to integrate.

We've implement it on our blog however it only seems to be searching recent posts (~15). Assuming this is because looking at the RSS feed it only loads so many posts.

Is there any way to have it search all our posts?

Smoother search-as-you-type updates

ghostHunter currently updates the list of search hits by clearing and restoring the list. Since many Ghost styles do quite a bit of display formatting, there is pretty severe jitter effect when onKeyUp is enabled. It should be possible to update the list using a Levenstein-distance tool, applying just the changes necessary in the current (last-search-result) display to make it reflect the incoming data array. I'll see if I can get this working, and if it works out, post a pull request after #42 has cleared.

{{Description}} is not out putting in search results

var searchField = $("#search-field").ghostHunter({
   results   : "#results",
   onKeyUp         : true,
   onPageLoad      : true,
   result_template : "<a href='{{link}}'><h2>{{title}}</h2><h4>{{pubDate}}</h4> <p>{{description}}</p></a>"
 });

I added that and all I get is the link title and date , no description?

and I had a look in the ghost api docs https://api.ghost.org/docs/post

but all I see for the post json object is

post: {
    id: 1,
    uuid: "ec630e45-3342-4d7f-a24c-e448263c975b",
    title: "Welcome to Ghost",
    slug: "welcome-to-ghost",
    markdown: "You're live! Nice.",
    html: "<p>You're live! Nice.</p>",
    image: '/content/images/2014/12/my-image.png',
    featured: false,
    page: false,
    status: 'published',
    language: "en_US",
    meta_title: null,
    meta_description: null,
    author_id: 1,
    created_at: "2014-04-15T12:36:28.353Z",
    created_by: 1,
    updated_at: "2014-04-15T12:36:28.353Z",
    updated_by: 1,
    published_at: "2014-04-15T12:36:28.363Z",
    published_by: 1
}

going to have a play around and change description to html but if it's something i'm doing wrong some help would be great

API from use without input

I receive a query parameter and want to get results from this value, how can I access the Plugin API?

Feature Request search by date

Hey, thanks for this really nice addon, it works really good for me.

One thing though that I would love to have is the ability to search by date, e.g. with a search query like 2018-05 which then finds all posts that were created in May 2018. Is something like this doable with your current application?

Support other languages

Does ghostHunter support other languages then english cause when I write post with an Hebrew title and search for the excat title - I get no results

Any Idea? is it something in the configurations ?

Use the full RSS feed

One question related to RSS: is it possible to use the full RSS feed instead of only the first page for the searchable content? /rss/ displays only a part of the published blog post, you can see the rest with /rss/2, /rss/3, ...

Search results disappeared in 0.4.1 and duplicated in 0.5.0

Hi, I have tried v0.3.5, 0.4.1, and 0.5.0 and noticed strange behaviors since version 0.4.1:

  • v0.5.0: search results duplicated every time a key is pressed, even with arrow keys
  • v0.4.1: no search results
  • v0.3.5: results displayed normally, but only words in the title are parsed, not the post content

Syntax used:

$(function() {
    
    /* search results */
    var res = {}
    res.body = '\n  <a href="{{link}}">\n    <span>{{title}}</span>\n    <span">{{pubDate}}</span>\n  </a>';
    res.info = '<p>Found {{amount}} stories</p>';
    
    
    $("#search-field").ghostHunter({
        results: "#results",
        onKeyUp: true,
        result_template: res.body,
        info_template: res.info,
        displaySearchInfo: true,
        zeroResultsInfo: false,
        includepages: false,
        onPageLoad: true
    });
});

Jquery version: 3.3.1 latest

Is this a bug or am I doing anything wrong?

Cyrillic search

Hello and thank you for your work!

I've installed ghostHunter on my fresh ghost blog, but soon I noticed, that only english matches show up in onKeyUp frame.

Multiple distinct indexes in different areas of a site?

Hi, I'm using ghost in a maybe-unusual way, with multiple substantially-distinct sets of stories in a single ghost instance.

Different sets of stories coexist and display in different areas of the site, with tags controlling what shows where.

In my case I happen to be implementing a multi-language site (under a single ghost instance), but I could imagine other use-cases for this type of tag-based partitioning.

So, what I'm wondering is what it would take to support "filtered indexing" in ghosthunter, whereby I would pass in, at initialization time, the tag filters that I want passed into the ghost API.

In my case I would only ever want one search on any one page of the site, so I don't need to worry about encapsulating configuration/initialization properties that are currently "global" in the ghosthunter plugin object.

As far as I could tell this should be very straightforward, with only two important changes to be made:

  1. Add support for passing the filter in, and having it be passed through to the ghost API call in indexing

  2. Ensure that the localstorage key (at index setting and retrieval time) is updated to include the filter key (or some other explicitly passed in identifier).

Is there anything else I'm clearly missing in this proposed scheme?

pubDate is only raw

Date is presented in a raw format (pubDate variable). I'd like a more pleasant one, ideally matching the way my theme outputs the date (and the installed locale).

I guess it is easy to accomplish for javascript programmers... but I'm not!

Domain-wide caching of search results

I recently installed a Ghost instance with a theme that supports ghostHunter search. Looking at transactions against the site, I found that it was reindexing all items for each page visited. To save network traffic and speed things up, I hacked the ghostHunter code in the theme to cache search results in localStorage.

In the hacked code, caching works as follows:

  • Three values are cached:
    • index: a serialized copy of the lunr.js index
    • blogData: a serialized copy of the item metadata for search returns
    • latestPost: the string value of updated_at as returned by the Ghost API
  • If isInit is falsey, we hit localStorage for the three values.
    • If the three values are found and parse successfully, we set isInit to true
  • If isInit is now true, we hit the Ghost API for only the id values of updates later than latestPost
    • If items are returned, we hit the Ghost API for all post data and regenerate the index
  • If isInit is still falsey, we also hit the Ghost API for all post data and regenerate the index

If no items have changed since the browser's last visit to the site, index data is reused. The only overhead is to reload the index out of localStorage.

The code seems to be working well for us. It's been done against a dated release of ghostHunter, but if the approach sounds interesting, I could work up a pull request against current ghostHunter master.

$(...).ghostHunter is not a function

Hi, locally it is working properly, I do not find any problem, I update the theme on the production site, and I get the following errors:

GET https://example.it/assets/js/jquery.ghosthunter.js/?v=f2e5f77e91 net::ERR_ABORTED
search.js?v=f2e5f77e91:1 Uncaught TypeError: $(...).ghostHunter is not a function
    at search.js?v=f2e5f77e91:1

script loaded
1 - jquery
2 - ghosthunter
3 - search.js -->$("#search-field").ghostHunter({});

Do you know the reason?

result_template not working

Setting result_template doesn't seem to be working.

Using

$("#search-field").ghostHunter({
    results : "#results",
    onKeyUp : true,
    zeroResultsInfo : false,
    //result_template : "<a href='{{link}}'><p><h2>{{title}}</h2><h4>{{pubDate}}</h4></p></a>"
});

will correctly yield the results' info and the results themselves.

However, uncommenting the commented line, which should simply set the template to its default value, will only show the results' info. If we look at the HTML source code, it appears that the correct structure has been created, but it has not been filled with content.

My best guess is that Ghost is consuming the variables before GhostHunter can get to them and replacing them with nothing.

standalone version

Could be nice offer a version without dependencies inside, like:

ghostHunter.standalone.min.js → wihtout lunr
ghostHunter.standalone.min.js → with lunr

this.target is undefined when clearing search results

Hi there,

I am getting the following error when trying to clear search results and search field value with searchField.clear(); :

Uncaught TypeError: Cannot read property 'val' of undefined
at Object.clear (jquery.ghosthunter.js?v=79caedeb82:3532)
at HTMLButtonElement. (custom.js?v=79caedeb82:87)
at HTMLButtonElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLButtonElement.y.handle (jquery-3.3.1.min.js:2)

Could you please help? Thank you.

Full-text search is blocking UI on page load

Hi! I use the Techno theme on my Ghost blog and the full-text search is blocking UI on page load (the initSearch() function in the default.js file). If I disable initSearch(), everything goes fine (except for the search function obviously ^^). I have a css animation on the homepage and it only runs after a delay, more than 10 seconds on my android phone.
On my blog I have only one article but he is very long (14200 words).

Here is my website : http://www.protection-cultures-histoire.fr/
Here is the repo of the website : https://github.com/Janaka-Steph/protection-cultures-histoire.fr

Thank you for your help.

Origin is not allowed by Access-Control-Allow-Origin

I am trying to host my ghost blog on both www.example.com and example.com. I set the site url of the blog to be example.com. If I try searching on example.com everything works as expected. If however, I try searching on www.example.com I get errors and search results are not returned. I'm guessing this has to do with CORS? Is there CORS somewhere in this code or is this a LocalStorage issue? Seems like you can't call the API methods from anything but the exact site url that you specify. Here is the error I get when trying to search:

https://example.com/blog/ghost/api/v0.1/posts/?limit=all&include=tags&formats=plaintext*client_id=ghost-frontend&client_secret=abcdef123

Failed to load resource: Origin https://www.example.com is not allowed by Access-Control-Allow-Origin.

Customizing the html template doesn't return {{link}}

I tried to customize the html template this way, because all I wanted to see in the results was the title.

<script>
    $("#search-field").ghostHunter({
        results   : "#results",
        onKeyUp         : true,
        result_template : "<a href='{{link}}'><p><h2>{{title}}</h2></p></a>"
    });
</script>

When I do search for posts get back the message: "Number of posts found:" + the actual number of posts. With the inspector i could see that he is creating the hrefs with the p and the h2 but the {{link}} abd the {{title}} will not appear.

<section id="results" style="text-align:center">
    <p>Number of posts found: 3</p>
    <a href=""><p></p><h2></h2><p></p></a>
    <a href=""><p></p><h2></h2><p></p></a>
    <a href=""><p></p><h2></h2><p></p></a>
</section>

I tried around for a while but couldn't get it to work. Without my customization everything works fine.

It does not work properly

I've always used a very old version of ghosthunter, about 185 lines of code, I've never had any kind of problem. I tried to update, the latest version is about 3500 lines of code, unfortunately I must say that it works very badly. I do not understand why. It does not sort the articles according to the search key, often in the search result there are articles completely unrelated to the searched word, or simply not find them all. I'm forced to go back to the previous version, old for several months, or years, fortunately I had saved it :)
I wanted to warn you of this problem, I'm probably wrong?

result_template and info_template disable search

I've been trying to change the result_template to remove the date from results each time I add the code to my site the search box is disabled.

<script> $("#search-field").ghostHunter({ results : "#results", onKeyUp : true, info_template : "

Number of posts found: {{amount}}

", result_template : "

{{title}} {{description}}

"
});</script></p>

"Number of posts:" is shown but no results appear.

Using WebWorker for build index

Build the index in the server side is a handicap, but could be also great use web worker for this task in the frontend side.

Search static page

Apparently it cannot search static page. Is this a known issue? Thanks!

Show in result_template

I'm showing results in a custom result using {{title}} and {{description}}, is it possible to show tags in this way? {{tag}}, at the moment I think it is not possiible, could it be an upcoming implementation?

cache index into browser storage

Instead of build index all the time, we can use browser storage (localStorage, SessionStorage, webSQL or IndexDB) as temporal cache

Exclude certain tags from search results?

Hi Jamal and everyone,

This search engine is marvelous! I'm wondering if it is possible to exclude certain tags from the search results? If yes, how to implement it?

ghost is not defined

Hello,
I've added it inside body in default.hbs:

 <form>
        <input id="search-field" />
        <input type="submit" value="search">
        <input type="button" value="clear" onclick="clearResults();" />
      </form>

      <hr />
        
      <section id="results"></section>

      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
      <script src="js/jquery.ghostHunter.js"></script>

      <script>

        var searchField = $("#search-field").ghostHunter({
                            results     : "#results",
                            rss         : "rss.xml",
                            //Enable the "search as you type" by uncommenting the following line
                            //onKeyUp   : true
                          });

        function clearResults() {
          searchField.clear();
        }

      </script>

But i'm getting the following error:

Uncaught ReferenceError: ghost is not defined
    at Object.loadAPI (jquery.ghostHunter.js:110)
    at HTMLInputElement.<anonymous> (jquery.ghostHunter.js:76)
    at HTMLInputElement.dispatch (jquery.min.js:5)
    at HTMLInputElement.v.handle (jquery.min.js:5)

How to fix it?
Thank you

Search function update assistance.

Hello, could someone update my Search function to support the latest ghosthunter? The goal of updating my search function is so users can be able to type anything in the Search bar and not be limited to only 15 responses. Plus, It would be great if when someone does update my Search function they edit any other files that could improve the search experience for users.

PS:
Sorry, If I made you mad @Windyo <3. I can be a little inpatient time to time but it would mean a lot if you took the time out of your day to help me with this problem. Lastly, I tried doing this myself but I could not get it to work and I contact the dev of the theme but he will not update he said. And is it necessary for me to turn on Public API?

Can't load all results when field is empty

Theoretically when the search field is emptied, it should return all results.

Calling clear() on the search field does not produce the intended results.

Before interaction
screenshot 2016-01-12 23 45 21

Entered field and pressed backspace
screenshot 2016-01-12 23 45 32

No results

#11
Hi, I'm having a similar issue to issue 11 - the search function worked previously when it was on v0.4.0 when I first added it but now it doesn't return any results. I'm getting ghostHunter: init - so it seems to be partially working, also there are no JS errors in the console.
Any help would be appreciated please!

Not recognising Ghost API

Apologies if this isn't the appropriate spot to post this, but I'm having some trouble getting it working. After following all the usage instructions, I get the following javascript error when I focus on the search box:

Uncaught ReferenceError: ghost is not defined
    at Object.loadAPI (jquery.ghostHunter.min.js?v=23405fddcb:1)
    at HTMLInputElement.<anonymous> (jquery.ghostHunter.min.js?v=23405fddcb:1)
    at HTMLInputElement.dispatch (jquery-latest.min.js:3)
    at HTMLInputElement.r.handle (jquery-latest.min.js:3)

Any thoughts why this is? I'm using up-to-date chrome on Windows 10. Thanks in advance for your help.

Lunr doesn't search correctly

Hello,

It looks like lunr v0.7.0 doesn't search correctly. For example I'm using Ghost v1.0.0 and I have multiple posts. 2 of them have the same name Welcome to Ghost. I implmented GhostHunter and it works like this:

I search for: w -> Both posts appear
I search for: we -> They don't appear
I search for: wel -> Both posts appear
...
I search for: welcome t -> Only one appears

The blogData seems to be ok but lunr does a bad parsing or something.

results.size is not a function

Hi there,

thanks you for this plugin.
I have updated it to version 0.5.0 in my theme but when trying to search I'm getting the following error:

Uncaught TypeError: results.size is not a function at Object. (jquery.ghosthunter.js?v=79caedeb82:3478)

HTML:

<form class="search-form">
	<input type="text" id="search-field" class="search-field" placeholder="Type your keywords&hellip;" />
	<input type="submit" class="search-submit" value="Search" />
</form>
<div id="search-results" class="search-results"></div>

jQuery code:

var searchField = $('#search-field').ghostHunter({
	results : "#search-results",
	onKeyUp : true
});

Can you help to fix it?
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.