Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Elevation Configuration #56

Open
wants to merge 2 commits into
base: primary
Choose a base branch
from

Conversation

marczhermo
Copy link
Collaborator

No description provided.

@codecov-io
Copy link

codecov-io commented Jun 3, 2019

Codecov Report

Merging #56 into primary will decrease coverage by 0.57%.
The diff coverage is 0.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             primary      #56      +/-   ##
=============================================
- Coverage      98.71%   98.13%   -0.58%     
- Complexity       610      612       +2     
=============================================
  Files             45       45              
  Lines           1708     1718      +10     
=============================================
  Hits            1686     1686              
- Misses            22       32      +10     
Impacted Files Coverage Δ Complexity Δ
src/Admins/SearchAdmin.php 23.07% <0.00%> (-76.93%) 3.00 <2.00> (+2.00) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e420742...77a4b04. Read the comment docs.

@Firesphere
Copy link
Owner

Yash, codecov.io is working again!

@Firesphere
Copy link
Owner

I've added the Criteria class, so you could use that for elevation probably :)

@marczhermo marczhermo force-pushed the sheepy/elevation-configuration branch from 5c6d77e to 8a145b0 Compare June 7, 2019 12:37
@Firesphere
Copy link
Owner

Could you please rebase?

@marczhermo marczhermo force-pushed the sheepy/elevation-configuration branch from 8a145b0 to bdeab0c Compare June 8, 2019 06:31
@Firesphere
Copy link
Owner

Needs a rebase :)

@marczhermo marczhermo force-pushed the sheepy/elevation-configuration branch from bdeab0c to bcf7bc6 Compare August 19, 2019 08:55
@ssmarco
Copy link
Contributor

ssmarco commented Aug 19, 2019

Not ready yet :)

@Firesphere Firesphere added the enhancement New feature or request label Aug 20, 2019
@Firesphere Firesphere mentioned this pull request Aug 20, 2019
@@ -12,13 +16,34 @@
class SearchAdmin extends ModelAdmin
{
private static $managed_models = [
SearchClass::class
SearchClass::class,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove SearchClass for now?

SearchClass::class
SearchClass::class,
Elevation::class,
ElevatedItem::class,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't ElevatedItem be managed through Elevation?


$gridField
->getConfig()
->addComponent(new GridFieldOrderableRows('Rank'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add inline editing if it's possible? Saves users from clicking "new" etc.

'Keywords' => Elevation::class,
];

private static $summary_fields = ['Title', 'Rank', 'ObjectClass', 'SolrID', 'Include', 'Exclude'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make it a list 😄

Also, I think ObjectClass should be replaced with a method, that returns the Singular name of the class. A bit more friendly :)

private static $table_name = 'ElevatedItem';

private static $db = [
'Rank' => 'Int',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you stick to my standard of aligning the =>? Sorry, I'm really picky 😄

'Items' => ElevatedItem::class,
];

private static $summary_fields = ['ID', 'Keyword'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, it would be good to list them out instead of using as a string.

Also, I'd add Items.Count, so people can see how many items are elevated by this keyword without having to look deeper.

@@ -810,7 +810,7 @@
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="df">_text</str>
<str name="df">text</str>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rename is good, but I'm mildly afraid it might clash at some point with the Text DBObject from SilverStripe, causing confusion in naming etc.. Do you have any thoughts about that?

@Firesphere
Copy link
Owner

Final comment, instead of using the elevate component from Solr, could you use the "At query time" elevation for this? It's a combination.

It would most likely make the code a lot clearer, having an buildElevation method on query time, compared to switching to the elevate endpoint.

Solarium docs around it are here:
https://solarium.readthedocs.io/en/stable/queries/select-query/building-a-select-query/components/query-elevation-component/

Given that currently we use the /select query everywhere, letting Solarium decide either based on the XML (thus Solr) or the query, is a more readable approach.

'SolrID' => 'Varchar(255)',
'Include' => 'Boolean(1)',
'Exclude' => 'Boolean(0)',
];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very thorough $db settings. I like!

'ObjectClass' => 'Varchar(255)',
'ObjectID' => 'Int',
'SolrID' => 'Varchar(255)',
'Include' => 'Boolean(1)',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability, I prefer using Boolean(true) and Boolean(false) over 1 and 0

@marczhermo marczhermo force-pushed the sheepy/elevation-configuration branch 3 times, most recently from 01e90e5 to 8e3dacc Compare September 13, 2019 01:35
@Firesphere Firesphere added this to the 1.0 milestone Sep 19, 2019
@Firesphere
Copy link
Owner

What is the current status?
I'm pondering, if you don't have enough time @marczhermo , we could push it to a release after 1.0?

@marczhermo
Copy link
Collaborator Author

Apologies @Firesphere, got distracted by a lot of things and React. I suggest after 1.0 release 😊

@Firesphere
Copy link
Owner

Coolbeans. It's not a heavy requirement to match FTS anyway :)

@Firesphere
Copy link
Owner

You might need to update the tests a bit :)

@Firesphere
Copy link
Owner

Woah! Did you get the React components working?! Really keen to see that in action!

@marczhermo
Copy link
Collaborator Author

Still a work in progress but yeah, the Search component is utilized as part of the implementation 😁 and more to come

@marczhermo marczhermo force-pushed the sheepy/elevation-configuration branch from f8fadb0 to 77a4b04 Compare March 4, 2020 10:50
@@ -57,4 +64,23 @@ public function init()

Requirements::css('firesphere/solr-search:client/dist/main.css');
}

public function getEditForm($id = null, $fields = null)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid variables with short names like $id. Configured minimum length is 3.


use SilverStripe\ORM\DataObject;

class ElevatedItem extends DataObject
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property $table_name is not named in camelCase.


use SilverStripe\ORM\DataObject;

class ElevatedItem extends DataObject
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property $belongs_many_many is not named in camelCase.


use SilverStripe\ORM\DataObject;

class ElevatedItem extends DataObject
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property $summary_fields is not named in camelCase.


class ElevatedItem extends DataObject
{
private static $table_name = 'ElevatedItem';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid unused private fields such as '$table_name'.

@codeclimate
Copy link

codeclimate bot commented Mar 4, 2020

Code Climate has analyzed commit 77a4b04 and detected 18 issues on this pull request.

Here's the issue category breakdown:

Category Count
Bug Risk 9
Style 9

The test coverage on the diff in this pull request is 0.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 98.0% (-0.5% change).

View more on Code Climate.

@Firesphere Firesphere closed this Oct 4, 2020
@Firesphere Firesphere reopened this Oct 4, 2020
@Firesphere Firesphere changed the base branch from master to primary October 4, 2020 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants