Word Count Search

Word Count Search 2.11.0

No permission to download
Are there any filters what to count?
I had a post with 75 words; then i add

word 1.1 2-2

and get 79 words. =>+4


When i add to 75 words this

wort 1.1 2-2

wort 1.1 2-2

wort 1.1 2-2

i got 89 words. => + 14

I dont see any rule for that.
Yes, i see one:
if
word 1.1 2-2 = 4 words;

then three times 4 words plus two empty lines are 14?
 
Now i added

wort 1.1 2-2

wort 1.1 2-2

wort 1.1 2-2

wort 1.1 2-2

wort 1.1 2-2

wort 1.1 2-2

and got 104 => + 29 = 6*4 words plus 5 lines?

This could be:

newline = +1
every word from two chars = +1

So i can understand the calculating, but not the sense of counting a new line also.
 
The method this uses is specified here; https://github.com/Xon/XenForo2-Wor...dCountSearch/Repository/WordCount.php#L27-L31

Or this;
PHP:
    protected function str_word_count_utf8($str)
    {
        // ref: http://php.net/manual/de/function.str-word-count.php#107363
        return count(preg_split('~[^\p{L}\p{N}\']+~u',$str));
    }

    public function getTextWordCount($message)
    {
        $strippedText = $this->app()->stringFormatter()->stripBbCode($message, ['stripQuote' => true]);
        // remove non-visible placeholders
        $strippedText = str_replace('[*]', ' ', $strippedText);
        return $this->str_word_count_utf8($strippedText);
    }

It is fairly rough approximation, but there is a reason it rounds when displaying.
 
Sorry, i have no idea what this means. But i can see the counter. And it seems that empty lines (linebreaks) are counted, when i try the examples from above.
 
hi @Xon can we use this addon to set noindex to a thread if threads words count < 500
It isn't supported out of the box, as the per-thread word-count isn't actually computed without my Threadmarks Pro add-on installed (ref).

After that, adding the no-index would be doable.

What you could do is add the no-index if the total words on the page was < 500 very easily with some template edits.
 
can you explain how?

If you add the following to the thread_view template;
XML:
<xf:set var="$pageWordCount" value="{{ 0 }}" />
<xf:foreach loop="$posts" value="$post">
    <xf:set var="$pageWordCount" value="{{ $pageWordCount +  $post.RawWordCount }}" />
</xf:foreach>
<xf:if is="$pageWordCount < 500">
    <xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
 
If you add the following to the thread_view template;
XML:
<xf:set var="$pageWordCount" value="{{ 0 }}" />
<xf:foreach loop="$posts" value="$post">
    <xf:set var="$pageWordCount" value="{{ $pageWordCount +  $post.RawWordCount }}" />
</xf:foreach>
<xf:if is="$pageWordCount < 500">
    <xf:head option="metaNoindex"><meta name="robots" content="noindex" /></xf:head>
</xf:if>
Thank you so much @Xon
that workes perfectly
i would like to also noindex all threads from node id 5
but can't make it workes with your code.
Can you help me on this.

Is your code will also work on page 2,3,4 etc ?
for exemple if there is a 2nd page with only 495 word, will it return a nofollow?

thank you so much for your magic
 
nofollow is frankly useless with how many things can link to it, you need to put the noindex on the actual page itself.

The code will work per-page to add the nonindex attribute.

To no-index all threads (and pages!) with a node_id of 5, this should work;
XML:
<xf:if is="$pageWordCount < 500 OR $thread.node_id == 5">
 
Top Bottom