Output parts of search results variables as objects

4 years 5 months ago #41938 by dmayak
Hello, I propose to change some of the variables supplied into search view (views/search/tmpl/default_results.php). The problem is that variables store different data in one string, thus making it unaccessable in view.
I am working on styling of the search results page right now on Flexicontent 2.1.1 r1793 and have problem styling parts of search results because they are united:
$result->section outputs section/category/item name all in one string, I cannot style them differently or display only category for example.
$result->text contains additional fields, I can see creation and modification dates, author, type, category and additional text fields in result string, divided by |, but I cannot do anything to it, except parcing and analysing with php in view, but its a nightmare.
same problem with total number of pages, I want to use only total number but although it is in separate span, it have the same class (item_total_value) as the number of displaying items, and because its all the same string I cannot use it in operations within view.
It would be better if variables mentioned above were objects, storing data separately.
I could not understand where this data is prepared unfortunately, tell me, which controller generates $result please.

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41945 by ggppdk
Hello

nightmare ? you make a wrong approach, this search structure has a purpose ! anyway i will spent some quality time to answer you,
please take time read below :) :

1. we use the Joomla way/paradigm for search structure of data,
that is why search data are structure like this,
e.g. search may include non FLEXIcontent areas (e.g. weblinks Joomla component)

$result->section is a UNIFIED way to display which part of site content matched the search, (it depicts search AREA e.g. weblinks and then category inside the search area)
... about $result->text it is similar reason ... read below


2. about result->text , you have misunderstood what this is ! , you should try to parse this ! it was never meant for this

-- it is the search index text, used for text searching !!
-- and reason for displaying it IS TO show where text search matched some words

1. you may choose to hide it, thus not show where text search matched CONTEXT

2. you may choose not to include some data into it, e.g. choose not include category title text into it,
e.g. not include date it to it, including dates maybe useful if e.g. user makes a text search for 2013 and you want this to be matched

3. you can still use FLEXIcontent filters for category or of date to filter your text searches,

so you may choose not to make category title text searchable or the date field text searchable, since your users can do it via filters

4. you can display FLEXIcontent filters via search view configuration

Regards


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41989 by dmayak
It seems that I have offended you with my post, sorry.
Edit: ok, I was completely wrong, now I got it, because there is already possible to include any of the fields into search results separately. I just have not know that creating a custom menu item for a search module would allow me to do that, my mistake.

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41991 by ggppdk
Hello

about text search

1. you can use "Advanced Index" for text search then the user can select in which fields to make the text search

e.g. he will make text search in "title" and in "field24" but not in description and in other fields marked as text searchable

in short both text search and filter is possible per field (see options and description in search menu item)

2. About item data, use:
if ( @ $result->fc_item_id ) {
  // current result is a FLEXIcontent item and not a contact or weblink or etc
  echo "<pre>" .print_r($item,true) ."</pre>";
}

thus then you can use ALL item information


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41992 by dmayak
Yes, looks like you replied just when I have understood that myself and was editing my previous post, sorry to waste your time. Still, I need develop custom functionality (search results in tabs for each category with its own pagination), so I need to understand better how search results and pagination is prepared. I would be very grateful if you just pointed me in which controller it is.

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41993 by ggppdk
About

the "controller"

-- the search results are retrieved by FLEXIcontent advanced search plugin
inside
plugins/search/flexiadvsearch/flexiadvsearch.php

-- and the filters are created inside the "view.html.php" of the FLEXIcontent search view
components/com_flexiocontent/views/search/view.html.php

Please avoid hacking files, it will make upgrading FLEXIcontent difficult

Regards


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

4 years 5 months ago #41994 by dmayak
Thank you, I will try to avoid direct modification. Best regards.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.