Filtering search results based on content-i18n

View: New views
5 Messages — Rating Filter:   Alert me  

Filtering search results based on content-i18n

by Markus Schwarz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi there,
I've got some trouble filtering my search query based on language. I  
use i18n based on url-rewriting with /de/ and /en/ prefixes.

In my search results i get always both, german and english results.  
how can I filter the results basen on language?

<form name="mgnlsearch" action="" method="post">
                        <input type="text" name="query" class="search" value="$
{param.query}"/>${blank}
                        <input type="image" class="searchButton" src="$
{pageContext.request.contextPath}/docroot/samples/imgs/search.gif"/>
                        </form>




Mit freundlichen Grüßen

i.A.  Markus Schwarz

---------------------------------------------------------------------
Dipl. Des. Markus Schwarz, Systemdesign


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------


Re: Filtering search results based on content-i18n

by Philipp Bärfuss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


There are two simple solutions:
- maintain each language tree separately (in that case you can  
restrict the search to a certain hierarchy)
- index the content externally. We have successfully used google site  
search for that:
   -- http://www.google.com/enterprise/search/index.html

The main problem of 1:1 i18n is that all content is stored under the  
same node and therefore the search is applied on all languages. This  
can be seen as a feature but might be unwanted in other cases.

Philipp


On 30.06.2009, at 10:15, Markus Schwarz wrote:

>
> Hi there,
> I've got some trouble filtering my search query based on language. I  
> use i18n based on url-rewriting with /de/ and /en/ prefixes.
>
> In my search results i get always both, german and english results.  
> how can I filter the results basen on language?
>
> <form name="mgnlsearch" action="" method="post">
> <input type="text" name="query" class="search" value="$
> {param.query}"/>${blank}
> <input type="image" class="searchButton" src="$
> {pageContext.request.contextPath}/docroot/samples/imgs/search.gif"/>
> </form>
>
>
>
>
> Mit freundlichen Grüßen
>
> i.A.  Markus Schwarz
>
> ---------------------------------------------------------------------
> Dipl. Des. Markus Schwarz, Systemdesign
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <user-list-unsubscribe@...>
> ----------------------------------------------------------------

Best regards,

Philipp Bärfuss
Magnolia International Ltd.

---------------------------------------
  Meet us at the Magnolia Conference
  http://www.magnolia-cms.com/conference
---------------------------------------

Magnolia®  - Simple Open Source Content Management


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------


Re: Filtering search results based on content-i18n

by gregoryjoseph :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Jun 30, 2009, at 12:03 PM, Philipp Bärfuss wrote:

>
> There are two simple solutions:
> - maintain each language tree separately (in that case you can  
> restrict the search to a certain hierarchy)
> - index the content externally. We have successfully used google  
> site search for that:
>  -- http://www.google.com/enterprise/search/index.html
3:
  - if you're using a single tree, customize the search query and add  
something along the lines of "and language='de'" to it, where  
'language' is the node property defining which language the page is in.


>
> The main problem of 1:1 i18n is that all content is stored under the  
> same node and therefore the search is applied on all languages. This  
> can be seen as a feature but might be unwanted in other cases.
>
> Philipp
>
>
> On 30.06.2009, at 10:15, Markus Schwarz wrote:
>
>>
>> Hi there,
>> I've got some trouble filtering my search query based on language.  
>> I use i18n based on url-rewriting with /de/ and /en/ prefixes.
>>
>> In my search results i get always both, german and english results.  
>> how can I filter the results basen on language?
>>
>> <form name="mgnlsearch" action="" method="post">
>> <input type="text" name="query" class="search" value="$
>> {param.query}"/>${blank}
>> <input type="image" class="searchButton" src="$
>> {pageContext.request.contextPath}/docroot/samples/imgs/search.gif"/>
>> </form>
>>
>>
>>
>>
>> Mit freundlichen Grüßen
>>
>> i.A.  Markus Schwarz
>>
>> ---------------------------------------------------------------------
>> Dipl. Des. Markus Schwarz, Systemdesign
>>
>>
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <user-list-unsubscribe@...>
>> ----------------------------------------------------------------
>
> Best regards,
>
> Philipp Bärfuss
> Magnolia International Ltd.
>
> ---------------------------------------
> Meet us at the Magnolia Conference
> http://www.magnolia-cms.com/conference
> ---------------------------------------
>
> Magnolia®  - Simple Open Source Content Management
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <user-list-unsubscribe@...>
> ----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------


Re: Filtering search results based on content-i18n

by Philipp Bärfuss :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


>> There are two simple solutions:
>> - maintain each language tree separately (in that case you can  
>> restrict the search to a certain hierarchy)
>> - index the content externally. We have successfully used google  
>> site search for that:
>> -- http://www.google.com/enterprise/search/index.html
> 3:
> - if you're using a single tree, customize the search query and add  
> something along the lines of "and language='de'" to it, where  
> 'language' is the node property defining which language the page is  
> in.

This won't work because the same node contains all language data:

- node
   - text_en
   - text_de

the only solution would be to consequently name the properties you  
search for: select * from nt:base where contains(text_de, expression).

@Markus: do I understand your problem correctly?

Philipp

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------


Re: Filtering search results based on content-i18n

by Markus Schwarz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi, Grégory and Philipp,
thanks a lot for your fast response, I thought about Grégorys  
solution, but didn't grok it.

Now I'll try to manage the query.

I already use a language-switch, which sets some strings, based on  
selected language:

<c:set var="currlang" value="${pageContext.request.contextPath}$
{requestScope['javax.servlet.forward.servlet_path']}"/>
        <c:set var="englisch" value="${fn:replace(currlang, '/de/', '/en/')}"/>
        <c:set var="deutsch" value="${fn:replace(currlang, '/en/', '/de/')}"/>

        <c:set var="suche" value="Search"/>

        <c:if test="${fn:contains(currlang, '/en/')}">
                <c:set var="suche" value="Search"/>
                <c:set var="ihreSuche" value="Your query: "/>
                <c:set var="sorry" value="Your search for - "/>
                <c:set var="sorryEnd"  value=" - did not match any documents."/>
        </c:if>
       
        <c:if test="${fn:contains(currlang, '/de/')}">
                <c:set var="suche" value="Suche"/>
                <c:set var="ihreSuche" value="Ihre Suchergebnisse: "/>
                <c:set var="sorry" value="Es wurden keine mit Ihrer Suchanfrage - "/>
                <c:set var="sorryEnd"  value=" - übereinstimmenden Dokumente  
gefunden."/>
        </c:if>

I will use the same logic to modifiy the query.




Mit freundlichen Grüßen

i.A.  Markus Schwarz

---------------------------------------------------------------------
Dipl. Des. Markus Schwarz, Systemdesign

Micromata GmbH
Marie-Calm-Str. 1-5
D-34131 Kassel

Tel:  +49 561 / 31 67 93 - 0
Fax: +49 561 / 31 67 93 - 11

m.schwarz@...
http://www.micromata.com

AG Kassel HRB 7370

Geschäftsführung:
Dipl.-Ing. Thomas Landgraf
Dipl.-Phys. Kai Reinhard



Am 30.06.2009 um 14:36 schrieb Philipp Bärfuss:

>
>>> There are two simple solutions:
>>> - maintain each language tree separately (in that case you can  
>>> restrict the search to a certain hierarchy)
>>> - index the content externally. We have successfully used google  
>>> site search for that:
>>> -- http://www.google.com/enterprise/search/index.html
>> 3:
>> - if you're using a single tree, customize the search query and add  
>> something along the lines of "and language='de'" to it, where  
>> 'language' is the node property defining which language the page is  
>> in.
>
> This won't work because the same node contains all language data:
>
> - node
>  - text_en
>  - text_de
>
> the only solution would be to consequently name the properties you  
> search for: select * from nt:base where contains(text_de, expression).
>
> @Markus: do I understand your problem correctly?
>
> Philipp
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <user-list-unsubscribe@...>
> ----------------------------------------------------------------
>


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <user-list-unsubscribe@...>
----------------------------------------------------------------